Import Upstream version 0.12

This commit is contained in:
openKylinBot 2022-05-14 02:55:23 +08:00
commit 558f16eff0
56 changed files with 48693 additions and 0 deletions

2
AUTHORS Normal file
View File

@ -0,0 +1,2 @@
Havoc Pennington <hp@redhat.com>
Julien Danjou <julien@danjou.info>

490
COPYING Normal file
View File

@ -0,0 +1,490 @@
Some code in liblf is under the LGPL, included in this file. This
means that effectively the whole library is LGPL until/unless the LGPL
code is replaced. However, most of the code is provided under a
so-called BSD/X-style license. Each source code file in liblf is
marked with the license that applies to that file.
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307 USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

316
ChangeLog Normal file
View File

@ -0,0 +1,316 @@
2009-01-28 Julien Danjou <julien@danjou.info>
* add xcb support
2007-03-17 Elijah Newren <newren gmail com>
* configure.in: post-release bump to 0.10.
2007-03-17 Elijah Newren <newren gmail com>
* NEWS: Version 0.9
2007-03-17 Elijah Newren <newren gmail com>
* libsn/sn-launcher.c (sn_launcher_context_initiate,
sn_launcher_context_setup_child_process): Patch from Laszlo Peter
at http://bugzilla.gnome.org/show_bug.cgi?id=392801, replacing
__FUNCTION__ with __func__ to increase portability.
2005-03-07 Mark McLoughlin <mark@skynet.ie>
Based on fix from Aivars Kalvans <aivars.kalvans@inbox.lv>
* libsn/sn-launchee.c: (sn_launchee_context_unref):
Unref the SnDisplay.
2005-02-26 Vincent Untz <vincent@vuntz.net>
* libsn/sn-xmessages.c: (parse_property): plug leak
(append_string_to_list): don't strdup() @append.
2004-11-10 Mark McLoughlin <mark@skynet.ie>
* configure.in: post-release bump to 0.9.
2004-11-10 Mark McLoughlin <mark@skynet.ie>
* configure.in: Version 0.8
2004-11-10 Mark McLoughlin <mark@skynet.ie>
* autogen.sh: use and require automake 1.7.
* configure.in: modernise a bit.
* acconfig.h: remove, not needed anymore.
2004-10-27 Havoc Pennington <hp@redhat.com>
* patch from Elijah Newren
http://bugzilla.gnome.org/show_bug.cgi?id=151245
to support new focus stealing prevention stuff.
2004-06-24 Mark McLoughlin <mark@skynet.ie>
* configure.in: post-release bump to 0.8.
2004-06-24 Mark McLoughlin <mark@skynet.ie>
* configure.in: Version 0.7.
2004-06-17 Elijah Newren <newren@math.utah.edu>
Make a timestamp be part of the startup sequence (and not just
part of the startup_id for the startup sequence).
* libsn/sn-launcher.c: Add timestamp field to the
SnLauncherContext struct,
(sn_launcher_context_new): initialize timestamp to 0,
(sn_launcher_context_initiate): Make timestamp part of the startup
sequence message,
* libsn/sn-monitor.c: Add timestamp field to the SnStartupSequence
struct,
(sn_startup_sequence_get_timestamp): new function,
(sn_startup_sequence_new): set timestamp from startup sequence
message, if found,
* libsn/sn-monitor.h:
(sn_startup_sequence_get_timestamp): new function,
* test/test-launcher.c:
(slowly_obtain_timestamp): new function
(main): Make the test-launcher example provide a valid timestamp,
obtained from new slowly_obtain_timestamp function
2004-04-01 Mark McLoughlin <mark@skynet.ie>
* configure.in: post-release bump to 0.7.
2004-04-01 Mark McLoughlin <mark@skynet.ie>
* configure.in: Version 0.6.
2004-03-23 Mark McLoughlin <mark@skynet.ie>
Leak plugging action from Tommi Leino <tommi.leino@movial.fi>
* libsn/sn-launcher.c: (sn_launcher_context_unref): plug leaks.
2003-04-20 Havoc Pennington <hp@pobox.com>
* use -no-undefined libtool flag on cygwin, from Masahiro Sakai
2003-01-20 Havoc Pennington <hp@pobox.com>
* configure.in: 0.5
* NEWS: update
2003-01-20 Havoc Pennington <hp@pobox.com>
* libsn/sn-xmessages.c (sn_internal_remove_xmessage_func):
initialize message_type field in FindHandlerData, fix from
Joe Marcus Clarke
2003-01-16 Havoc Pennington <hp@redhat.com>
* libsn/sn-xmessages.c: delete global variables for xmessage_funcs
and pending_messages, use per-display data.
* libsn/sn-common.c (sn_internal_display_get_xmessage_data): store
the list of xmessage handlers and pending messages per-display,
so things work halfway correctly
2002-12-15 Havoc Pennington <hp@pobox.com>
* libsn/sn-launchee.c (sn_launchee_context_setup_window):
_NET_STARTUP_ID should be a UTF-8 string. #101237
2002-12-07 Havoc Pennington <hp@pobox.com>
* libsn/sn-xmessages.c (sn_internal_append_to_string_escaped):
handle zero-length string properly, avoids a crash
2002-12-02 Havoc Pennington <hp@redhat.com>
* doc/Makefile.am (EXTRA_DIST): dist the startup-notification.txt
file
2002-11-30 Havoc Pennington <hp@pobox.com>
* libsn/sn-launcher.c (sn_launcher_context_complete): new function
(sn_launcher_context_initiate): remove debug spew, and record
initiation time
(sn_launcher_context_get_initiated_time): new function
(sn_launcher_context_get_last_active_time): new function
* libsn/sn-monitor.c (sn_startup_sequence_get_initiated_time):
allow NULL return locations
* configure.in: bump version to 0.4 (not releasing yet though)
* libsn/sn-monitor.c (sn_startup_sequence_complete): new function
so the WM or tasklist can time out a sequence.
(xmessage_func): add support for SCREEN field, kill the startup
sequence immediately if SCREEN isn't provided.
2002-11-01 Havoc Pennington <hp@pobox.com>
* libsn/sn-launcher.c (sn_launcher_context_set_extra_property):
implement
2002-11-01 Havoc Pennington <hp@pobox.com>
* libsn/sn-launcher.c (sn_launcher_context_initiate): fill in
SCREEN env variable, and call DESKTOP that instead of DESCRIPTION
2002-10-29 Havoc Pennington <hp@pobox.com>
* configure.in: 0.3
2002-10-27 Anders Carlsson <andersca@gnu.org>
* test/Makefile.am: Use "libstartup-notification" instead of libsn.
2002-10-25 Havoc Pennington <hp@pobox.com>
* libstartup-notification-1.0.pc.in (Cflags): fix -I flag
* libsn/sn-monitor.c (sn_startup_sequence_get_initiated_time): new
function
(sn_startup_sequence_get_last_active_time): new function
2002-10-24 Havoc Pennington <hp@pobox.com>
* test/Makefile.am (INCLUDES): -DSN_API_NOT_YET_FROZEN=1
* libsn/sn-common.h: put in the little API-not-frozen warning.
* libsn/Makefile.am, configure.in, autogen.sh: rename to
"libstartup-notification" instead of "libsn"
2002-10-23 Havoc Pennington <hp@pobox.com>
* libsn/sn-common.h (SnLaunchType): remove
* libsn/sn-common.c (sn_display_get_x_screen): make it
sn_internal_display_get_x_screen
* Makefile.am: add .pc file to Makefile
2002-10-23 Havoc Pennington <hp@redhat.com>
* libsn/sn-xmessages.c: implement type_atom_begin stuff
* doc/startup-notification.txt: add the idea of "type_atom_begin"
to distinguish the first client message in an X message.
2002-10-22 Havoc Pennington <hp@redhat.com>
* doc/startup-notification.txt: fixes from Lubos
2002-10-21 Havoc Pennington <hp@pobox.com>
* doc/startup-notification.txt: Add "SCREEN" property, and note
that there may be a max message size.
* libsn/sn-xmessages.c (sn_internal_unserialize_message): fix the
escaping
2002-10-20 Havoc Pennington <hp@pobox.com>
* libsn/sn-monitor.c: port to new setup, add multihead support
* libsn/sn-launcher.c: port to new setup, and blow away
all monitoring stuff, just use sn-monitor.h
* libsn/sn-xmessages.c: make it all multihead-safe
* libsn/sn-launchee.c: port to new setup and strip the other stuff
out
* doc/startup-notification.txt:
s/DESKTOP_LAUNCH_ID/DESKTOP_STARTUP_ID/ for env variable,
add _NET_STARTUP_ID window manager hint.
2002-10-20 Havoc Pennington <hp@pobox.com>
* doc/startup-notification.txt: new docs, new proposed spec
2002-10-20 Havoc Pennington <hp@pobox.com>
* Massively rename everything from liblf to libsn, and reimport
to CVS.
2002-09-20 Havoc Pennington <hp@pobox.com>
* liblf/lf-monitor.c: implement support for xmessage-based
protocol.
2002-09-20 Havoc Pennington <hp@redhat.com>
* liblf/lf-xmessages.c: implement parsing the property lists
as in KStartupInfo
2002-09-20 Havoc Pennington <hp@redhat.com>
* liblf/lf-xutils.c (lf_internal_send_event_all_screens): new
function
* liblf/lf-launcher.c (lf_launcher_context_initiate): use new
lf_internal_send_event_all_screens
* liblf/lf-xmessages.c: implement serializing strings
via client messages
* liblf/lf-common.c (lf_display_process_event): process xmessage
events
2002-09-12 Havoc Pennington <hp@pobox.com>
* liblf/lf-launcher.c (lf_launcher_context_initiate): validate
UTF-8 for the hostname
2002-09-12 Havoc Pennington <hp@redhat.com>
* liblf/lf-monitor.c: fixes
2002-09-12 Havoc Pennington <hp@redhat.com>
* liblf/lf-monitor.c: mostly workingish now
2002-09-12 Havoc Pennington <hp@pobox.com>
* test/test-monitor.c: test program for the monitor
API
* liblf/lf-monitor.c: finishing up
2002-09-11 Havoc Pennington <hp@redhat.com>
* liblf/lf-monitor.c: hacking
2002-09-10 Havoc Pennington <hp@redhat.com>
* lotsa fixes and more work
2002-09-10 Havoc Pennington <hp@pobox.com>
* liblf/lf-launcher.c: more implementation hacking
2002-09-09 Havoc Pennington <hp@redhat.com>
* liblf/lf-list.c: add a list abstraction
* liblf/lf-launcher.c: start implementing
* liblf/lf-common.c (lf_display_process_event): update docs
* doc/launch-notification.txt: some small tweaks
* COPYING: include LGPL
* liblf/lf-util.c: fix the copyright

0
INSTALL Normal file
View File

8
Makefile.am Normal file
View File

@ -0,0 +1,8 @@
SUBDIRS=libsn test doc
EXTRA_DIST=libstartup-notification-1.0.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libstartup-notification-1.0.pc

790
Makefile.in Normal file
View File

@ -0,0 +1,790 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libstartup-notification-1.0.pc.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libstartup-notification-1.0.pc
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSN_CFLAGS = @LIBSN_CFLAGS@
LIBSN_LIBS = @LIBSN_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
x11_xcb_CFLAGS = @x11_xcb_CFLAGS@
x11_xcb_LIBS = @x11_xcb_LIBS@
xcb_CFLAGS = @xcb_CFLAGS@
xcb_LIBS = @xcb_LIBS@
xcb_aux_CFLAGS = @xcb_aux_CFLAGS@
xcb_aux_LIBS = @xcb_aux_LIBS@
xcb_event_CFLAGS = @xcb_event_CFLAGS@
xcb_event_LIBS = @xcb_event_LIBS@
SUBDIRS = libsn test doc
EXTRA_DIST = libstartup-notification-1.0.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libstartup-notification-1.0.pc
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
libstartup-notification-1.0.pc: $(top_builddir)/config.status $(srcdir)/libstartup-notification-1.0.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-pkgconfigDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

49
NEWS Normal file
View File

@ -0,0 +1,49 @@
0.12
====
- Revert a change that break ABI (Julien Cristau)
0.11
====
- Remove Xlib support, use only xcb and x11-xcb (Julien Danjou)
- Support APPLICATION_ID key (Colin Walters)
0.10
====
- Remove useless functions (Julien Danjou)
- Add XCB backend (Julien Danjou)
0.9
===
- plug some leaks (Vincent Untz, Aivars Kalvans)
- fix compilation on sun machines (Laszlo Peter)
0.8
===
- Support new focus stealing prevention stuff (Elijah Newren)
- Use automake 1.7
0.7
===
- Implement timestamp support (Elijah Newren)
0.6
===
- Fix some fairly serious memory leaks (Tommi Leino)
- Cygwin build fix (Masahiro Sakai)
0.5
===
- Fix use of uninitialized memory when closing down a display (Joe Marcus Clarke)
- Make xmessage handling use per-display instead of global variables,
fixing total hosage on multihead X servers
- set _NET_STARTUP_ID as a UTF-8 string
- fix a crash caused by zero-length message data
- include startup-notification.txt specification in the distribution

0
README Normal file
View File

9610
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

1517
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

77
config.h.in Normal file
View File

@ -0,0 +1,77 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `backtrace' function. */
#undef HAVE_BACKTRACE
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* whether realloc (NULL,) works */
#undef REALLOC_0_WORKS
/* Define if you have correct malloc prototypes */
#undef SANE_MALLOC_PROTOS
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING

1760
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

15246
configure vendored Executable file

File diff suppressed because it is too large Load Diff

103
configure.in Normal file
View File

@ -0,0 +1,103 @@
AC_INIT([startup-notification], [0.12],
[http://www.freedesktop.org/Software/startup-notification])
AC_CONFIG_SRCDIR(libsn/sn-launchee.c)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
# Honor aclocal flags
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")
AM_MAINTAINER_MODE
AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_PATH_XTRA
if test x$no_x = xyes ; then
AC_MSG_ERROR([X11 development libraries/headers not found])
fi
dnl (check from glib)
dnl ok, here we try to check whether the systems prototypes for
dnl malloc and friends actually match the prototypes provided
dnl by sn-common.h (keep in sync). i currently only know how to check
dnl this reliably with gcc (-Werror), improvements for other
dnl compilers are appreciated.
SANE_MALLOC_PROTOS=no
AC_MSG_CHECKING([if malloc() and friends prototypes are sn-util.h compatible])
lf_save_CFLAGS=$CFLAGS
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([#include <stdlib.h>], [
void* (*my_calloc_p) (size_t, size_t) = calloc;
void* (*my_malloc_p) (size_t) = malloc;
void (*my_free_p) (void*) = free;
void* (*my_realloc_p) (void*, size_t) = realloc;
my_calloc_p = 0;
my_malloc_p = 0;
my_free_p = 0;
my_realloc_p = 0;
],
AC_DEFINE(SANE_MALLOC_PROTOS, 1,
[Define if you have correct malloc prototypes])
SANE_MALLOC_PROTOS=yes)
fi
AC_MSG_RESULT($SANE_MALLOC_PROTOS)
CFLAGS=$lf_save_CFLAGS
dnl *** check for sane realloc() ***
AC_CACHE_CHECK([whether realloc (NULL,) will work],lf_cv_sane_realloc,[
AC_TRY_RUN([
#include <stdlib.h>
int main() {
return realloc (0, sizeof (int)) == 0;
}],
[lf_cv_sane_realloc=yes],
[lf_cv_sane_realloc=no],
[])
])
if test x$lf_cv_sane_realloc = xyes; then
AC_DEFINE(REALLOC_0_WORKS,1,[whether realloc (NULL,) works])
fi
## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
PKG_CHECK_MODULES([xcb], [xcb >= 1.6],,
[AC_MSG_ERROR([Cannot find xcb])])
PKG_CHECK_MODULES([xcb_aux], [xcb-aux],,
[AC_MSG_ERROR([Cannot find xcb-aux])])
PKG_CHECK_MODULES([xcb_event], [xcb-event],,
[AC_MSG_ERROR([Cannot find xcb-event])])
PKG_CHECK_MODULES([x11_xcb], [x11-xcb],,
[AC_MSG_ERROR([Cannot find x11-xcb])])
LIBSN_CFLAGS="$xcb_CFLAGS $xcb_aux_CFLAGS $xcb_event_CFLAGS $x11_xcb_CFLAGS"
LIBSN_LIBS="$xcb_LIBS $xcb_aux_LIBS $x11_xcb_LIBS"
AC_SUBST(LIBSN_CFLAGS)
AC_SUBST(LIBSN_LIBS)
AC_CONFIG_FILES([
Makefile
libsn/Makefile
test/Makefile
doc/Makefile
libstartup-notification-1.0.pc
])
AC_OUTPUT

630
depcomp Executable file
View File

@ -0,0 +1,630 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

2
doc/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
EXTRA_DIST=startup-notification.txt

371
doc/Makefile.in Normal file
View File

@ -0,0 +1,371 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSN_CFLAGS = @LIBSN_CFLAGS@
LIBSN_LIBS = @LIBSN_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
x11_xcb_CFLAGS = @x11_xcb_CFLAGS@
x11_xcb_LIBS = @x11_xcb_LIBS@
xcb_CFLAGS = @xcb_CFLAGS@
xcb_LIBS = @xcb_LIBS@
xcb_aux_CFLAGS = @xcb_aux_CFLAGS@
xcb_aux_LIBS = @xcb_aux_LIBS@
xcb_event_CFLAGS = @xcb_event_CFLAGS@
xcb_event_LIBS = @xcb_event_LIBS@
EXTRA_DIST = startup-notification.txt
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,449 @@
Startup notification protocol
===
This document specifies a mechanism allowing a desktop environment to
track application startup, to provide user feedback and other
features.
Version: 0.1
Revised: October 20, 2002
Authors: Lubos Lunak, Havoc Pennington
Terms
===
Launch: a "startup event" such as opening a new window, opening a new
application, or adding a panel applet. Note that the
launch may or may not involve creating a new UNIX process.
Launcher: code which starts up a launch
Launchee: code which is started up by the launcher
X Messages
===
"X messages" are a mechanism for sending text strings between X
clients.
To send a string as an X message, a client does the following:
- Creates an X window to be used to identify the message
uniquely. This window need not be mapped, and may be
a child of any window.
- Interns atoms type_atom and type_atom_begin indicating
the type of message.
- Decides on a target_xwindow; this is the root window
for "broadcast" messages, or a specific client's window.
- Send a series of client messages to the target X window, where each
client message contains a portion of the string. The client
messages should have the window field set to the X window
identifying the message, the format field set to 8, and
the message_type field set to the type of message, type_atom_begin
for the first client message and type_atom for any following client
messages.
The last byte used in the last client message must be nul, and no
intermediate bytes may be nul. The nul byte identifies
the end of the message.
Client messages must be sent to the chosen target_xwindow, with the
event mask PropertyChangeMask.
(FIXME this is a bad choice of mask, as we get a bunch of annoying
PropertyNotify events; but which mask would be better?)
Attachment "A" contains example code.
- Destroys the unique X window used to identify the message.
The window can be destroyed immediately, it is only used
for its window ID.
Implementations may impose a maximum length of message they are
willing to accept. Typically this length will be reasonably low,
perhaps 4K of data.
Key-value strings
===
The specific strings sent during startup notification encode a message
type, followed by a list of key-value pairs. Here is an example:
new: NAME="Hello World" PID=252
A string listing key-value pairs works as follows:
- the entire string must be valid UTF-8. Invalid strings should be
discarded as corrupt, as accepting bad data leads to
interoperability problems. (Learn from web browsers.)
Although the string is UTF-8, parsing is specified in terms of
bytes not characters in the below specification.
- all bytes up to the first ':' byte indicate the type of the
message. If the message contains no ':' byte it should be discarded
as corrupt.
- To find the start of a key, the ':' byte delimiting the message
type must be skipped. Any space (' ') bytes following it must also
be skipped. (Other kinds of whitespace must not be skipped.) The
first non-' ' byte after the ':' byte is the start of the first
key.
- All bytes until the next '=' byte form the name of the
key. The '=' byte should be discarded, as it delimits the
key from the value.
- Parsing of the value begins with the byte immediately following the
'=' byte. The value is parsed
as follows.
There are two dimensions, "escaped" and "quoted", creating 4
states:
- escaped = TRUE quoted = TRUE
. the current byte is appended literally, and the escaped
flag is set to FALSE
- escaped = TRUE quoted = FALSE
. the current byte is appended literally, and the escaped
flag is set to FALSE
- escaped = FALSE quoted = FALSE
. if the current byte is a double quote '"' it is
discarded, and the quoted flag is set to TRUE
. if the current byte is a backslash '\', it is
discarded, and the escaped flag is set to TRUE
. if the current byte is a space ' ' byte or nul byte,
the end of the value has been reached
. any other byte, INCLUDING tabs, newlines, etc., must be
appended literally.
- escaped = FALSE quoted = TRUE:
. if the current byte is a double quote '"'
it is discarded, and the quoted flag is
set to FALSE
. if the current byte is a backslash '\'
it is discarded, and the escaped flag
is set to TRUE
. otherwise the current byte is appended literally
If a nul byte is seen in a state other than escaped = FALSE
quoted = FALSE, it is an error, and the message should be discarded
as corrupt.
Note that the escaping here is simpler than either C string literal
escaping, or shell quoting. Unlike C string literals, "\n" means
"the letter n," not "newline"; unlike quoted shell strings, "\e"
means "the letter e," not "backslash followed by the letter e."
Note that an empty string can be represented by simply not
including a value before the first whitespace, as in FOO:
FOO= NAME=Hello
or by empty quotes as in BAR:
BAR="" NAME=Hello
- Once the end of the value has been reached, any space (' ') bytes
should be skipped. The first non-' ' byte is the first byte of the
next key.
Note that keys are case-sensitive, Foo and FOO are different keys.
Startup notification
===
The startup notification protocol involves sending X messages with the
message_type atom _NET_STARTUP_INFO_BEGIN/_NET_STARTUP_INFO to the
root window. In multihead setups, the messages should go to the root
window of the X screen where the launchee application is being
launched.
As a general convention, any key-value pairs in startup notification
messages that aren't understood by a given client should be ignored by
that client. Also, any keys or message types not documented here must
be prefixed by the two bytes "X-" as in "X-myproperty" or
"X-mymessage".
All messages in the startup notification protocol refer to a "startup
sequence"; a "startup sequence" reflects a single launch event.
Here are the message types ("message types" here means the type at the
beginning of the message string, not the type of the X message):
new: message indicating that a new startup sequence has been
initiated. The key-value pairs in this message indicate the
properties of the startup sequence. If this startup sequence
already exists, "new:" message is equivalent to "change:"
(i.e. the values are updated instead of creating a new
startup sequence).
change: message changing a startup sequence. Clients should update
information about the matching startup sequence to the newly
provides information. "change" messages contain
a subset of the keys allowed in a "new" message. Not all
attributes of the startup sequence are allowed to change
over time.
"change:" messages not be taken as a "new:" message,
i.e. they should not cause any feedback or similar.
If a client has not seen a "new:" message for the same sequence,
then it should remember the information for later use in case
a "new:" message comes later. "change:" messages without
a following "new:" message can be discarded after a reasonable
timeout (>= 1 minute). Rationale: The application
may want to send certain information like timestamp or description
first, before handling control to library code deciding
if there should be actually any feedback for the launch.
remove: message ending a startup sequence. Once this message
has been seen for a given sequence, any further
messages referring to the sequence should be ignored.
All messages must include these keys:
ID
uniquely identifies a startup sequence; should be some globally
unique string (for example, hostname+pid+"_TIME"+current time).
The string should be in the form of <unique>_TIME<timestamp>,
where the timestamp is the X server timestamp of the user
action that caused the launch. See the TIMESTAMP key
for details.
The following keys are required in a "new" message and may be included
in either a "new" or a "changed" message:
NAME
some human-readable name of the item being started;
for example, "Control Center" or "Untitled Document";
this name should be localized.
SCREEN
the X screen number the startup sequence is on
The following keys may be provided optionally in either a "new" or a
"changed" message:
BIN
name of the executable being started, argv[0]
ICON
a string to be interpreted exactly as the "Icon" field
in desktop entries is interpreted.
LAUNCHED_BY
identification of the top-level window in which the launch was initiated.
The value is the X window ID of the window.
DESKTOP
the desktop on which the application should appear,
counting from 0, as in _NET_WM_DESKTOP. However,
this value should never override a _NET_WM_DESKTOP
property set on window that's being mapped.
This desktop is relative to the screen provided by
the SCREEN key.
TIMESTAMP
X server timestamp of the user action that caused this
launch. For example window manager that doesn't allow
stealing of focus by newly mapped windows while the user
works in an application can use this timestamp for windows
that have matching _NET_STARTUP_ID property if they don't
have any _NET_WM_USER_TIME property set or if it's older.
See the description of _NET_WM_USER_TIME in the WM spec
for details.
This key is obsoleted by including the timestamp directly
in the ID field.
DESCRIPTION
a short description suitable for display in a dialog that
indicates what's happening. For example "Opening document
Foo" or "Launching KWord" - the description should be in
"foo-ing whatever" format, describing the current status.
WMCLASS
a string to match against the "resource name" or "resource
class" hints. If this key is present, the launchee will most
likely not send a "remove" message on its own. If the
desktop environment detects a toplevel window mapped with
this name or class, it should send a "remove" message for
the startup sequence. Note that the class hint is in
Latin-1, so the value of this key must be converted to
Latin-1 before strcmp'ing it with the window class/name.
(Though in all known cases only ASCII is involved so it
doesn't matter.)
SILENT
a boolean (1/0) value. When set to 1, there should be
no visual feedback. This can be used to suspend
the visual feedback temporarily, e.g. when
application shows a dialog during its startup before
mapping the main window. Another use is for launch
sequences for applications that are neither compliant
nor their WMClass is known, but which should preferably
have their window mapped on the desktop specified by
the value of DESKTOP.
APPLICATION_ID
When launching an application using a .desktop file from
the normal application paths (see desktop file specification),
this should be basename of the .desktop file.
For example: "foo.desktop".
When launching a .desktop file NOT in the paths, this should
be an absolute path to the .desktop file.
Some details of the startup sequence:
- "new" and "change" messages are sent by the launcher code
- the launchee code is responsible for sending a "remove"
message to end the launch sequence, unless the WMCLASS
key was set.
- the "new" message must be the first message. Other message
types should be ignored by all clients unless those clients
have seen a "new" message with the same ID.
- "change" messages can be sent at any time between "new" and
"remove"
Communicating from a launcher process to a launchee process
===
To communicate the startup sequence information from a launcher
process to a launchee process, when possible an environment variable
should be used:
DESKTOP_STARTUP_ID
value of the "ID" field in the "new" message
It is suggested to unset this environment variable in the launchee
as soon as it's read, to avoid possible reuse by some process started
later by launchee.
Mechanisms other than the environment variable may be used as well, as
long as they are reliable. The environment variable is only used when
the launchee code is in a process started by the launcher code; if
they are in the same process the environment variable may not be
relevant.
Desktop entry spec extensions
===
StartupNotify=BOOLEAN
If true, it is KNOWN that the application will send a "remove"
message when started with the DESKTOP_LAUNCH_ID environment variable
set.
If false, it is KNOWN that the application does not work
with startup notification at all (does not shown any window, breaks
even when using StartupWMClass, etc.).
If absent, a reasonable handling is up to implementations (assuming false,
using StartupWMClass, etc.).
StartupWMClass=STRING
If specified, it is KNOWN that the application will map at least one
window with the given string as its WM class or WM name hint.
EWMH spec extensions
===
_NET_STARTUP_ID, UTF8_STRING
The ID used for the startup sequence for the window. If set
on a group leader window, applies to all application windows
in that group that do not set their own _NET_STARTUP_ID.
If a new value for the property is set, the window manager
should update the window's status accordingly (update its virtual
desktop, etc.).
Launchee failures
===
The launcher process is responsible for detecting launchee failures
such as a crash and should end the launch sequence in such case.
In case launchee fails to end the launch sequence, clients should
treat the launch sequence as ended withing a reasonable time.
A. Sample code to send X message
===
This code omits creation/destruction of "xwindow" which is the unique
identifier window for the message. It should be created just before
this code and destroyed just after.
XEvent xevent;
const char *src;
const char *src_end;
char *dest;
char *dest_end;
xevent.xclient.type = ClientMessage;
xevent.xclient.message_type = type_atom_begin;
xevent.xclient.display = xdisplay;
xevent.xclient.window = xwindow;
xevent.xclient.format = 8;
src = message;
src_end = message + strlen (message) + 1; /* +1 to include nul byte */
while (src != src_end)
{
dest = &xevent.xclient.data.b[0];
dest_end = dest + 20;
if (src == message)
{
*dest = '\0';
++dest;
}
while (dest != dest_end &&
src != src_end)
{
*dest = *src;
++dest;
++src;
}
XSendEvent (xdisplay,
target_xwindow,
False,
PropertyChangeMask,
xevent);
xevent.xclient.message_type = type_atom_begin;
}
Change history
===
Changes since 0.1:
- TIMESTAMP field is obsoleted by including the timestamp directly in the ID.
- data from "change:" messages should be used even if they precede the matching "new:" message
- added LAUNCHED_BY
- Explicitly mention that updating the _NET_STARTUP_ID property on a window should trigger
window manager's actions for the new startup notification again.

520
install-sh Executable file
View File

@ -0,0 +1,520 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

33
libsn/Makefile.am Normal file
View File

@ -0,0 +1,33 @@
INCLUDES=-I$(top_srcdir) $(LIBSN_CFLAGS) -DSN_API_NOT_YET_FROZEN=1
libsnincludedir=$(includedir)/startup-notification-1.0/libsn
lib_LTLIBRARIES=libstartup-notification-1.la
libsninclude_HEADERS= \
sn.h \
sn-common.h \
sn-launchee.h \
sn-launcher.h \
sn-monitor.h \
sn-util.h
libstartup_notification_1_la_SOURCES= \
sn-common.c \
sn-internals.c \
sn-internals.h \
sn-launchee.c \
sn-launcher.c \
sn-list.c \
sn-list.h \
sn-monitor.c \
sn-util.c \
sn-xmessages.c \
sn-xmessages.h \
sn-xutils.c \
sn-xutils.h
libstartup_notification_1_la_LDFLAGS = -no-undefined
libstartup_notification_1_la_LIBADD= $(LIBSN_LIBS)

600
libsn/Makefile.in Normal file
View File

@ -0,0 +1,600 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libsn
DIST_COMMON = $(libsninclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libsnincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libstartup_notification_1_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libstartup_notification_1_la_OBJECTS = sn-common.lo sn-internals.lo \
sn-launchee.lo sn-launcher.lo sn-list.lo sn-monitor.lo \
sn-util.lo sn-xmessages.lo sn-xutils.lo
libstartup_notification_1_la_OBJECTS = \
$(am_libstartup_notification_1_la_OBJECTS)
libstartup_notification_1_la_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libstartup_notification_1_la_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libstartup_notification_1_la_SOURCES)
DIST_SOURCES = $(libstartup_notification_1_la_SOURCES)
HEADERS = $(libsninclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSN_CFLAGS = @LIBSN_CFLAGS@
LIBSN_LIBS = @LIBSN_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
x11_xcb_CFLAGS = @x11_xcb_CFLAGS@
x11_xcb_LIBS = @x11_xcb_LIBS@
xcb_CFLAGS = @xcb_CFLAGS@
xcb_LIBS = @xcb_LIBS@
xcb_aux_CFLAGS = @xcb_aux_CFLAGS@
xcb_aux_LIBS = @xcb_aux_LIBS@
xcb_event_CFLAGS = @xcb_event_CFLAGS@
xcb_event_LIBS = @xcb_event_LIBS@
INCLUDES = -I$(top_srcdir) $(LIBSN_CFLAGS) -DSN_API_NOT_YET_FROZEN=1
libsnincludedir = $(includedir)/startup-notification-1.0/libsn
lib_LTLIBRARIES = libstartup-notification-1.la
libsninclude_HEADERS = \
sn.h \
sn-common.h \
sn-launchee.h \
sn-launcher.h \
sn-monitor.h \
sn-util.h
libstartup_notification_1_la_SOURCES = \
sn-common.c \
sn-internals.c \
sn-internals.h \
sn-launchee.c \
sn-launcher.c \
sn-list.c \
sn-list.h \
sn-monitor.c \
sn-util.c \
sn-xmessages.c \
sn-xmessages.h \
sn-xutils.c \
sn-xutils.h
libstartup_notification_1_la_LDFLAGS = -no-undefined
libstartup_notification_1_la_LIBADD = $(LIBSN_LIBS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libsn/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu libsn/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libstartup-notification-1.la: $(libstartup_notification_1_la_OBJECTS) $(libstartup_notification_1_la_DEPENDENCIES)
$(libstartup_notification_1_la_LINK) -rpath $(libdir) $(libstartup_notification_1_la_OBJECTS) $(libstartup_notification_1_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-common.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-internals.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-launchee.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-launcher.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-monitor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-xmessages.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sn-xutils.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-libsnincludeHEADERS: $(libsninclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libsnincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libsnincludedir)"
@list='$(libsninclude_HEADERS)'; test -n "$(libsnincludedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsnincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libsnincludedir)" || exit $$?; \
done
uninstall-libsnincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libsninclude_HEADERS)'; test -n "$(libsnincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(libsnincludedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(libsnincludedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libsnincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-libsnincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES uninstall-libsnincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-libsnincludeHEADERS install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-libLTLIBRARIES uninstall-libsnincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

478
libsn/sn-common.c Normal file
View File

@ -0,0 +1,478 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include "sn-common.h"
#include "sn-internals.h"
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#include <X11/Xlib-xcb.h>
struct SnDisplay
{
int refcount;
Display *xdisplay;
xcb_connection_t *xconnection;
xcb_screen_t **screens;
xcb_atom_t UTF8_STRING, NET_STARTUP_ID,
NET_STARTUP_INFO, NET_STARTUP_INFO_BEGIN;
SnDisplayErrorTrapPush push_trap_func;
SnDisplayErrorTrapPop pop_trap_func;
SnXcbDisplayErrorTrapPush xcb_push_trap_func;
SnXcbDisplayErrorTrapPop xcb_pop_trap_func;
int n_screens;
SnList *xmessage_funcs;
SnList *pending_messages;
};
/**
* sn_display_new:
* @xdisplay: an X window system display
* @push_trap_func: function to push an X error trap
* @pop_trap_func: function to pop an X error trap
*
* Creates a new #SnDisplay object, containing
* data that libsn associates with an X display.
*
* @push_trap_func should be a function that causes X errors to be
* ignored until @pop_trap_func is called as many times as
* @push_trap_func has been called. (Nested push/pop pairs must be
* supported.) The outermost @pop_trap_func in a set of nested pairs
* must call XSync() to ensure that all errors that will occur have in
* fact occurred. These functions are used to avoid X errors due to
* BadWindow and such.
*
* Return value: the new #SnDisplay
**/
SnDisplay*
sn_display_new (Display *xdisplay,
SnDisplayErrorTrapPush push_trap_func,
SnDisplayErrorTrapPop pop_trap_func)
{
SnDisplay *display = sn_xcb_display_new(XGetXCBConnection(xdisplay),
NULL, NULL);
display->xdisplay = xdisplay;
display->push_trap_func = push_trap_func;
display->pop_trap_func = pop_trap_func;
return display;
}
/**
* sn_xcb_display_new:
* @xdisplay: an X window system connection
* @push_trap_func: function to push an X error trap
* @pop_trap_func: function to pop an X error trap
*
* Creates a new #SnDisplay object, containing
* data that libsn associates with an X connection.
*
* @push_trap_func should be a function that causes X errors to be
* ignored until @pop_trap_func is called as many times as
* @push_trap_func has been called. (Nested push/pop pairs must be
* supported.)
* These functions are used to avoid X errors due to BadWindow and
* such.
*
* Return value: the new #SnDisplay
**/
SnDisplay*
sn_xcb_display_new (xcb_connection_t *xconnection,
SnXcbDisplayErrorTrapPush push_trap_func,
SnXcbDisplayErrorTrapPop pop_trap_func)
{
SnDisplay *display;
int i;
/* Get all atoms we will need in the future */
xcb_intern_atom_cookie_t atom_utf8_string_c =
xcb_intern_atom(xconnection, FALSE,
sizeof("UTF8_STRING") - 1, "UTF8_STRING");
xcb_intern_atom_cookie_t atom_net_startup_info_begin_c =
xcb_intern_atom(xconnection, FALSE,
sizeof("_NET_STARTUP_INFO_BEGIN") - 1,
"_NET_STARTUP_INFO_BEGIN");
xcb_intern_atom_cookie_t atom_net_startup_info_c =
xcb_intern_atom(xconnection, FALSE,
sizeof("_NET_STARTUP_INFO") - 1, "_NET_STARTUP_INFO");
xcb_intern_atom_cookie_t atom_net_startup_id_c =
xcb_intern_atom(xconnection, FALSE,
sizeof("_NET_STARTUP_ID") - 1, "_NET_STARTUP_ID");
display = sn_new0 (SnDisplay, 1);
display->xconnection = xconnection;
display->n_screens = xcb_setup_roots_length (xcb_get_setup (xconnection));
display->screens = sn_new (xcb_screen_t*, display->n_screens);
display->refcount = 1;
display->xcb_push_trap_func = push_trap_func;
display->xcb_pop_trap_func = pop_trap_func;
for (i = 0; i < display->n_screens; ++i)
display->screens[i] = xcb_aux_get_screen(xconnection, i);
xcb_intern_atom_reply_t *atom_reply;
atom_reply = xcb_intern_atom_reply(display->xconnection,
atom_utf8_string_c,
NULL);
display->UTF8_STRING = atom_reply->atom;
free(atom_reply);
atom_reply = xcb_intern_atom_reply(display->xconnection,
atom_net_startup_info_begin_c,
NULL);
display->NET_STARTUP_INFO_BEGIN = atom_reply->atom;
free(atom_reply);
atom_reply = xcb_intern_atom_reply(display->xconnection,
atom_net_startup_info_c,
NULL);
display->NET_STARTUP_INFO = atom_reply->atom;
free(atom_reply);
atom_reply = xcb_intern_atom_reply(display->xconnection,
atom_net_startup_id_c,
NULL);
display->NET_STARTUP_ID = atom_reply->atom;
free(atom_reply);
return display;
}
/**
* sn_display_ref:
* @display: an #SnDisplay
*
* Increment the reference count for @display
**/
void
sn_display_ref (SnDisplay *display)
{
display->refcount += 1;
}
/**
* sn_display_unref:
* @display: an #SnDisplay
*
* Decrement the reference count for @display, freeing
* display if the reference count reaches zero.
**/
void
sn_display_unref (SnDisplay *display)
{
display->refcount -= 1;
if (display->refcount == 0)
{
if (display->xmessage_funcs)
sn_list_free (display->xmessage_funcs);
if (display->pending_messages)
sn_list_free (display->pending_messages);
sn_free (display->screens);
sn_free (display);
}
}
/**
* sn_display_get_x_display:
* @display: an #SnDisplay
* This function only returns a value if the SnDisplay
* has been created with sn_display_new().
*
*
*
* Return value: X display for this #SnDisplay
**/
Display*
sn_display_get_x_display (SnDisplay *display)
{
return display->xdisplay;
}
/**
* sn_display_get_x_connection:
* @display: an #SnDisplay
* This function only returns a value if the SnDisplay
* has been created with sn_xcb_display_new().
*
*
*
* Return value: X connection for this #SnDisplay
**/
xcb_connection_t*
sn_display_get_x_connection(SnDisplay *display)
{
return display->xconnection;
}
/**
* sn_internal_display_get_id:
* @display: an #SnDisplay
*
*
*
* Return value: X display id.
**/
void *
sn_internal_display_get_id (SnDisplay *display)
{
return display->xconnection;
}
/**
* sn_internal_display_get_x_screen:
* @display: an #SnDisplay
* @number: screen number to get
*
* Gets a screen by number; if the screen number
* does not exist, returns %NULL.
*
* Return value: X screen or %NULL
**/
xcb_screen_t*
sn_internal_display_get_x_screen (SnDisplay *display,
int number)
{
if (number < 0 || number >= display->n_screens)
return NULL;
else
return display->screens[number];
}
/**
* sn_internal_display_get_root_window:
* @display: an #SnDisplay
* @number: screen number to get root window from
*
* Gets a root window; if the screen number
* does not exist, returns %NULL.
*
* Return value: X root window or %NULL
**/
xcb_window_t
sn_internal_display_get_root_window (SnDisplay *display,
int number)
{
if (number >= 0 && number < display->n_screens)
return display->screens[number]->root;
return None;
}
/**
* sn_internal_display_get_screen_number:
* @display an #SnDisplay
*
*
*
* Return value: The number of screen for this #SnDisplay
**/
int
sn_internal_display_get_screen_number (SnDisplay *display)
{
return display->n_screens;
}
/**
* sn_display_process_event:
* @display: a display
* @xevent: X event
*
* libsn should be given a chance to see all X events by passing them
* to this function. If the event was a property notify or client
* message related to the launch feedback protocol, the
* sn_display_process_event() returns true. Calling
* sn_display_process_event() is not currently required for launchees,
* only launchers and launch feedback displayers. The function returns
* false for mapping, unmapping, window destruction, and selection
* events even if they were involved in launch feedback.
*
* Return value: true if the event was a property notify or client message involved in launch feedback
**/
sn_bool_t
sn_display_process_event (SnDisplay *display,
XEvent *xevent)
{
sn_bool_t retval;
retval = FALSE;
if (sn_internal_monitor_process_event (display))
retval = TRUE;
switch(xevent->xany.type)
{
case ClientMessage:
if (sn_internal_xmessage_process_client_message (display,
xevent->xclient.window,
xevent->xclient.message_type,
xevent->xclient.data.b))
retval = TRUE;
break;
default:
break;
}
return retval;
}
/**
* sn_xcb_display_process_event:
* @display: a display
* @xevent: X event
*
* libsn should be given a chance to see all X events by passing them
* to this function. If the event was a property notify or client
* message related to the launch feedback protocol, the
* sn_display_process_event() returns true. Calling
* sn_display_process_event() is not currently required for launchees,
* only launchers and launch feedback displayers. The function returns
* false for mapping, unmapping, window destruction, and selection
* events even if they were involved in launch feedback.
*
* Return value: true if the event was a property notify or client message involved in launch feedback
**/
sn_bool_t
sn_xcb_display_process_event (SnDisplay *display,
xcb_generic_event_t *xevent)
{
sn_bool_t retval;
retval = FALSE;
if (sn_internal_monitor_process_event (display))
retval = TRUE;
switch(XCB_EVENT_RESPONSE_TYPE(xevent))
{
case XCB_CLIENT_MESSAGE:
{
xcb_client_message_event_t *ev = (xcb_client_message_event_t *) xevent;
if (sn_internal_xmessage_process_client_message (display,
ev->window,
ev->type,
(const char *) ev->data.data8))
retval = TRUE;
}
break;
default:
break;
}
return retval;
}
/**
* sn_display_error_trap_push:
* @display: a display
*
* Calls the push_trap_func from sn_display_new() if non-NULL.
**/
void
sn_display_error_trap_push (SnDisplay *display)
{
/* SnDisplay has been created for Xlib */
if (display->xdisplay)
{
if (display->push_trap_func)
(* display->push_trap_func) (display, display->xdisplay);
}
else
{
if (display->xcb_push_trap_func)
(* display->xcb_push_trap_func) (display, display->xconnection);
}
}
/**
* sn_display_error_trap_pop:
* @display: a display
*
* Calls the pop_trap_func from sn_display_new() if non-NULL.
**/
void
sn_display_error_trap_pop (SnDisplay *display)
{
/* SnDisplay has been created for Xlib */
if (display->xdisplay)
{
if (display->pop_trap_func)
(* display->pop_trap_func) (display, display->xdisplay);
}
else
{
if (display->xcb_pop_trap_func)
(* display->xcb_pop_trap_func) (display, display->xconnection);
}
}
void
sn_internal_display_get_xmessage_data (SnDisplay *display,
SnList **funcs,
SnList **pending)
{
if (display->xmessage_funcs == NULL)
display->xmessage_funcs = sn_list_new ();
if (display->pending_messages == NULL)
display->pending_messages = sn_list_new ();
if (funcs)
*funcs = display->xmessage_funcs;
if (pending)
*pending = display->pending_messages;
}
xcb_atom_t
sn_internal_get_utf8_string_atom(SnDisplay *display)
{
return display->UTF8_STRING;
}
xcb_atom_t
sn_internal_get_net_startup_id_atom(SnDisplay *display)
{
return display->NET_STARTUP_ID;
}
xcb_atom_t
sn_internal_get_net_startup_info_atom(SnDisplay *display)
{
return display->NET_STARTUP_INFO;
}
xcb_atom_t
sn_internal_get_net_startup_info_begin_atom(SnDisplay *display)
{
return display->NET_STARTUP_INFO_BEGIN;
}

76
libsn/sn-common.h Normal file
View File

@ -0,0 +1,76 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_COMMON_H__
#define __SN_COMMON_H__
#include <libsn/sn-util.h>
#include <X11/Xlib.h>
#include <xcb/xcb.h>
SN_BEGIN_DECLS
#ifndef SN_API_NOT_YET_FROZEN
#error "libstartup-notification should only be used if you understand that it's subject to frequent change, and is not yet supported as a fixed API/ABI or as part of the platform"
#endif
typedef struct SnDisplay SnDisplay;
typedef void (* SnDisplayErrorTrapPush) (SnDisplay *display,
Display *xdisplay);
typedef void (* SnDisplayErrorTrapPop) (SnDisplay *display,
Display *xdisplay);
typedef void (* SnXcbDisplayErrorTrapPush) (SnDisplay *display,
xcb_connection_t *xconnection);
typedef void (* SnXcbDisplayErrorTrapPop) (SnDisplay *display,
xcb_connection_t *xconnection);
SnDisplay* sn_display_new (Display *xdisplay,
SnDisplayErrorTrapPush push_trap_func,
SnDisplayErrorTrapPop pop_trap_func);
SnDisplay* sn_xcb_display_new (xcb_connection_t *xconnection,
SnXcbDisplayErrorTrapPush push_trap_func,
SnXcbDisplayErrorTrapPop pop_trap_func);
void sn_display_ref (SnDisplay *display);
void sn_display_unref (SnDisplay *display);
Display* sn_display_get_x_display (SnDisplay *display);
xcb_connection_t* sn_display_get_x_connection (SnDisplay *display);
sn_bool_t sn_display_process_event (SnDisplay *display,
XEvent *xevent);
sn_bool_t sn_xcb_display_process_event (SnDisplay *display,
xcb_generic_event_t *xevent);
void sn_display_error_trap_push (SnDisplay *display);
void sn_display_error_trap_pop (SnDisplay *display);
SN_END_DECLS
#endif /* __SN_COMMON_H__ */

0
libsn/sn-internals.c Normal file
View File

103
libsn/sn-internals.h Normal file
View File

@ -0,0 +1,103 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_INTERNALS_H__
#define __SN_INTERNALS_H__
#include <libsn/sn-common.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libsn/sn-list.h>
#include <libsn/sn-xutils.h>
SN_BEGIN_DECLS
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL ((void*) 0)
#endif
/* --- From sn-common.c --- */
xcb_screen_t* sn_internal_display_get_x_screen (SnDisplay *display,
int number);
xcb_window_t sn_internal_display_get_root_window (SnDisplay *display,
int number);
int sn_internal_display_get_screen_number (SnDisplay *display);
void* sn_internal_display_get_id (SnDisplay *display);
void sn_internal_display_get_xmessage_data (SnDisplay *display,
SnList **funcs,
SnList **pending);
xcb_atom_t sn_internal_get_utf8_string_atom(SnDisplay *display);
xcb_atom_t sn_internal_get_net_startup_id_atom(SnDisplay *display);
xcb_atom_t sn_internal_get_net_startup_info_atom(SnDisplay *display);
xcb_atom_t sn_internal_get_net_startup_info_begin_atom(SnDisplay *display);
/* --- From sn-monitor.c --- */
sn_bool_t sn_internal_monitor_process_event (SnDisplay *display);
/* --- From sn-util.c --- */
sn_bool_t sn_internal_utf8_validate (const char *str,
int max_len);
char* sn_internal_strdup (const char *str);
char* sn_internal_strndup (const char *str,
int n);
void sn_internal_strfreev (char **strings);
unsigned long sn_internal_string_to_ulong (const char* str);
char* sn_internal_find_last_occurrence (const char* haystack,
const char* needle);
void sn_internal_append_to_string (char **append_to,
int *current_len,
const char *append);
/* --- From sn-xmessages.c --- */
sn_bool_t sn_internal_xmessage_process_client_message (SnDisplay *display,
xcb_window_t window,
xcb_atom_t type,
const char *data);
SN_END_DECLS
#endif /* __SN_INTERNALS_H__ */

226
libsn/sn-launchee.c Normal file
View File

@ -0,0 +1,226 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "sn-launchee.h"
#include "sn-internals.h"
#include "sn-xmessages.h"
#include <errno.h>
struct SnLauncheeContext
{
int refcount;
SnDisplay *display;
int screen;
char *startup_id;
};
/**
* sn_launchee_context_new:
* @display: an #SnDisplay
* @screen: an X screen number
* @startup_id: launch ID as in DESKTOP_STARTUP_ID env variable
*
* Creates a new launchee-side context for the startup notification
* protocol.
*
* Return value: a new launchee context
**/
SnLauncheeContext*
sn_launchee_context_new (SnDisplay *display,
int screen,
const char *startup_id)
{
SnLauncheeContext *context;
context = sn_new0 (SnLauncheeContext, 1);
context->refcount = 1;
context->display = display;
sn_display_ref (context->display);
context->screen = screen;
context->startup_id = sn_internal_strdup (startup_id);
return context;
}
/**
* sn_launchee_context_new_from_environment:
* @display: an #SnDisplay
* @screen: an X screen number
*
* Tries to create an #SnLauncheeContext given information in the
* program's environment (DESKTOP_STARTUP_ID environment
* variable). Returns %NULL if the env variables are not available or
* can't be parsed.
*
* Return value: a new #SnLauncheeContext or %NULL
**/
SnLauncheeContext*
sn_launchee_context_new_from_environment (SnDisplay *display,
int screen)
{
const char *id_str;
id_str = getenv ("DESKTOP_STARTUP_ID");
if (id_str == NULL)
return NULL;
return sn_launchee_context_new (display, screen, id_str);
}
void
sn_launchee_context_ref (SnLauncheeContext *context)
{
context->refcount += 1;
}
void
sn_launchee_context_unref (SnLauncheeContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
sn_display_unref (context->display);
sn_free (context->startup_id);
sn_free (context);
}
}
/**
* sn_launchee_context_get_startup_id:
* @context: an #SnLauncheeContext
*
* Get the startup ID for the context.
*
* Return value: the startup ID for the context.
**/
const char*
sn_launchee_context_get_startup_id (SnLauncheeContext *context)
{
return context->startup_id;
}
/**
* sn_launchee_context_get_id_has_timestamp:
* @context: an #SnLauncheeContext
*
* Return whether the startup ID for the context contains a timestamp
*
* Return value: whether the startup ID has an embedded timestamp
**/
int
sn_launchee_context_get_id_has_timestamp (SnLauncheeContext *context)
{
char * time_str;
time_str = sn_internal_find_last_occurrence(context->startup_id, "_TIME");
return time_str != NULL;
}
/**
* sn_launchee_context_get_timestamp:
* @context: an #SnLauncheeContext
*
* Return the timestamp embedded in the startup ID
*
* Return value: timestamp embedded in the startup ID
**/
Time
sn_launchee_context_get_timestamp (SnLauncheeContext *context)
{
char * time_str;
time_str = sn_internal_find_last_occurrence(context->startup_id, "_TIME");
if (time_str != NULL)
{
/* Skip past the "_TIME" part */
time_str += 5;
return sn_internal_string_to_ulong (time_str);
}
fprintf (stderr,
"libsn: No timestamp contained in the startup ID!\n");
/* Unfortunately, all values are valid; let's just return -1 */
return -1;
}
/**
* sn_launchee_context_complete:
* @context: an #SnLauncheeContext
*
* Called by the launchee when it is fully started up and the startup
* sequence should end.
*
**/
void
sn_launchee_context_complete (SnLauncheeContext *context)
{
char *keys[2];
char *vals[2];
char *message;
keys[0] = "ID";
keys[1] = NULL;
vals[0] = context->startup_id;
vals[1] = NULL;
message = sn_internal_serialize_message ("remove",
(const char**) keys,
(const char**) vals);
sn_internal_broadcast_xmessage (context->display,
context->screen,
sn_internal_get_net_startup_info_atom(context->display),
sn_internal_get_net_startup_info_begin_atom(context->display),
message);
sn_free (message);
}
/**
* sn_launchee_context_setup_window:
* @context: a #SnLauncheeContext
* @xwindow: window to be set up
*
* Sets up @xwindow, marking it as launched by the startup sequence
* represented by @context. For example sets the _NET_STARTUP_ID
* property. Only the group leader windows of an application MUST be
* set up with this function, though if any other windows come from a
* separate startup sequence, they can be set up separately.
*
**/
void
sn_launchee_context_setup_window (SnLauncheeContext *context,
Window xwindow)
{
sn_internal_set_utf8_string (context->display,
(xcb_window_t)xwindow,
sn_internal_get_net_startup_id_atom(context->display),
context->startup_id);
}

52
libsn/sn-launchee.h Normal file
View File

@ -0,0 +1,52 @@
/* Launchee API - if you are a program started by other programs */
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_LAUNCHEE_H__
#define __SN_LAUNCHEE_H__
#include <libsn/sn-common.h>
SN_BEGIN_DECLS
typedef struct SnLauncheeContext SnLauncheeContext;
SnLauncheeContext* sn_launchee_context_new (SnDisplay *display,
int screen,
const char *startup_id);
SnLauncheeContext* sn_launchee_context_new_from_environment (SnDisplay *display,
int screen);
void sn_launchee_context_ref (SnLauncheeContext *context);
void sn_launchee_context_unref (SnLauncheeContext *context);
const char* sn_launchee_context_get_startup_id (SnLauncheeContext *context);
int sn_launchee_context_get_id_has_timestamp (SnLauncheeContext *context);
Time sn_launchee_context_get_timestamp (SnLauncheeContext *context);
void sn_launchee_context_complete (SnLauncheeContext *context);
void sn_launchee_context_setup_window (SnLauncheeContext *context,
Window xwindow);
SN_END_DECLS
#endif /* __SN_LAUNCHEE_H__ */

501
libsn/sn-launcher.c Normal file
View File

@ -0,0 +1,501 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "sn-launcher.h"
#include "sn-internals.h"
#include "sn-xmessages.h"
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include <assert.h>
static SnList* context_list = NULL;
struct SnLauncherContext
{
int refcount;
SnDisplay *display;
int screen;
char *startup_id;
char *name;
char *description;
int workspace;
char *wmclass;
char *binary_name;
char *icon_name;
char *application_id;
struct timeval initiation_time;
unsigned int completed : 1;
unsigned int canceled : 1;
};
/**
* sn_launcher_context_new:
* @display: an #SnDisplay
* @screen: X screen number
* @event_func: function to be called when a notable event occurs
* @event_func_data: data to pass to @event_func
* @free_data_func: function to be called on @event_func_data when freeing the context
*
* Creates a new launcher context, to be used by the program that is
* starting a startup sequence. For example a file manager might
* create a launcher context when the user double-clicks on
* an application icon.
*
* Return value: a new #SnLauncherContext
**/
SnLauncherContext*
sn_launcher_context_new (SnDisplay *display,
int screen)
{
SnLauncherContext *context;
if (context_list == NULL)
context_list = sn_list_new ();
context = sn_new0 (SnLauncherContext, 1);
context->refcount = 1;
context->display = display;
context->screen = screen;
sn_display_ref (context->display);
context->workspace = -1;
sn_list_prepend (context_list, context);
return context;
}
/**
* sn_launcher_context_ref:
* @context: a #SnLauncherContext
*
* Increments the reference count of @context
**/
void
sn_launcher_context_ref (SnLauncherContext *context)
{
context->refcount += 1;
}
/**
* sn_launcher_context_unref:
* @context: a #SnLauncherContext
*
* Decrements the reference count of @context and frees the
* context if the count reaches zero.
**/
void
sn_launcher_context_unref (SnLauncherContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
sn_list_remove (context_list, context);
sn_free (context->startup_id);
sn_free (context->name);
sn_free (context->description);
sn_free (context->wmclass);
sn_free (context->binary_name);
sn_free (context->icon_name);
sn_free (context->application_id);
sn_display_unref (context->display);
sn_free (context);
}
}
static char*
strip_slashes (const char *src)
{
char *canonicalized_name;
char *s;
canonicalized_name = sn_internal_strdup (src);
s = canonicalized_name;
while (*s)
{
if (*s == '/')
*s = '|';
++s;
}
return canonicalized_name;
}
/**
* sn_launcher_context_initiate:
* @context: an #SnLaunchContext
* @launcher_name: name of the launcher app, suitable for debug output
* @launchee_name: name of the launchee app, suitable for debug output
* @timestamp: X timestamp of event causing the launch
*
* Initiates a startup sequence. All the properties of the launch (such
* as type, geometry, description) should be set up prior to
* initiating the sequence.
**/
void
sn_launcher_context_initiate (SnLauncherContext *context,
const char *launcher_name,
const char *launchee_name,
Time timestamp)
{
static int sequence_number = 0;
static sn_bool_t have_hostname = FALSE;
static char hostbuf[257];
char *s;
int len;
char *canonicalized_launcher;
char *canonicalized_launchee;
int i;
#define MAX_PROPS 12
char *names[MAX_PROPS];
char *values[MAX_PROPS];
char *message;
char workspacebuf[257];
char screenbuf[257];
if (context->startup_id != NULL)
{
fprintf (stderr, "%s called twice for the same SnLaunchContext\n",
__func__);
return;
}
if (!have_hostname)
{
if (gethostname (hostbuf, sizeof (hostbuf)-1) == 0)
have_hostname = TRUE;
else
hostbuf[0] = '\0';
}
canonicalized_launcher = strip_slashes (launcher_name);
canonicalized_launchee = strip_slashes (launchee_name);
/* man I wish we could use g_strdup_printf */
len = strlen (launcher_name) + strlen (launchee_name) +
256; /* 256 is longer than a couple %d and some slashes */
s = sn_malloc (len + 3);
snprintf (s, len, "%s/%s/%d-%d-%s_TIME%lu",
canonicalized_launcher, canonicalized_launchee,
(int) getpid (), (int) sequence_number, hostbuf,
(unsigned long) timestamp);
++sequence_number;
sn_free (canonicalized_launcher);
sn_free (canonicalized_launchee);
context->startup_id = s;
i = 0;
names[i] = "ID";
values[i] = context->startup_id;
++i;
names[i] = "SCREEN";
sprintf (screenbuf, "%d", context->screen);
values[i] = screenbuf;
++i;
if (context->name != NULL)
{
names[i] = "NAME";
values[i] = context->name;
++i;
}
if (context->description != NULL)
{
names[i] = "DESCRIPTION";
values[i] = context->description;
++i;
}
if (context->workspace >= 0)
{
names[i] = "DESKTOP";
sprintf (workspacebuf, "%d", context->workspace);
values[i] = workspacebuf;
++i;
}
if (context->wmclass != NULL)
{
names[i] = "WMCLASS";
values[i] = context->wmclass;
++i;
}
if (context->binary_name != NULL)
{
names[i] = "BIN";
values[i] = context->binary_name;
++i;
}
if (context->icon_name != NULL)
{
names[i] = "ICON";
values[i] = context->icon_name;
++i;
}
if (context->application_id != NULL)
{
names[i] = "APPLICATION_ID";
values[i] = context->application_id;
++i;
}
assert (i < MAX_PROPS);
names[i] = NULL;
values[i] = NULL;
gettimeofday (&context->initiation_time, NULL);
message = sn_internal_serialize_message ("new",
(const char**) names,
(const char**) values);
sn_internal_broadcast_xmessage (context->display,
context->screen,
sn_internal_get_net_startup_info_atom(context->display),
sn_internal_get_net_startup_info_begin_atom(context->display),
message);
sn_free (message);
}
void
sn_launcher_context_complete (SnLauncherContext *context)
{
char *keys[2];
char *vals[2];
char *message;
if (context->startup_id == NULL)
{
fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
"sn_launcher_context_complete");
return;
}
keys[0] = "ID";
keys[1] = NULL;
vals[0] = context->startup_id;
vals[1] = NULL;
message = sn_internal_serialize_message ("remove",
(const char**) keys,
(const char **) vals);
sn_internal_broadcast_xmessage (context->display,
context->screen,
sn_internal_get_net_startup_info_atom(context->display),
sn_internal_get_net_startup_info_begin_atom(context->display),
message);
sn_free (message);
}
const char*
sn_launcher_context_get_startup_id (SnLauncherContext *context)
{
return context->startup_id;
}
sn_bool_t
sn_launcher_context_get_initiated (SnLauncherContext *context)
{
return context->startup_id != NULL;
}
/**
* sn_launcher_context_setup_child_process:
* @context: an #SnLauncherContext
*
* This function should be called after forking, but before exec(), in
* the child process being launched. It sets up the environment variables
* telling the child process about the launch ID.
* This function will leak the strings passed to putenv() so should
* only be used prior to an exec().
*
**/
void
sn_launcher_context_setup_child_process (SnLauncherContext *context)
{
char *startup_id;
if (context->startup_id == NULL)
{
fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
"sn_launcher_context_setup_child_process");
return;
}
/* Man we need glib here */
startup_id = sn_malloc (strlen (context->startup_id) + strlen ("DESKTOP_STARTUP_ID") + 3);
strcpy (startup_id, "DESKTOP_STARTUP_ID=");
strcat (startup_id, context->startup_id);
putenv (startup_id);
/* Can't free strings passed to putenv */
}
/* FIXME use something pluggable, not fprintf */
#define WARN_ALREADY_INITIATED(context) do { if ((context)->startup_id != NULL) { \
fprintf (stderr, "%s called for an SnLauncherContext that has already been initiated\n", \
__func__); \
return; \
} } while (0)
void
sn_launcher_context_set_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->name);
context->name = sn_internal_strdup (name);
}
void
sn_launcher_context_set_description (SnLauncherContext *context,
const char *description)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->description);
context->description = sn_internal_strdup (description);
}
void
sn_launcher_context_set_workspace (SnLauncherContext *context,
int workspace)
{
WARN_ALREADY_INITIATED (context);
context->workspace = workspace;
}
void
sn_launcher_context_set_wmclass (SnLauncherContext *context,
const char *klass)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->wmclass);
context->wmclass = sn_internal_strdup (klass);
}
void
sn_launcher_context_set_binary_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->binary_name);
context->binary_name = sn_internal_strdup (name);
}
void
sn_launcher_context_set_icon_name (SnLauncherContext *context,
const char *name)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->icon_name);
context->icon_name = sn_internal_strdup (name);
}
void
sn_launcher_set_application_id (SnLauncherContext *context,
const char *desktop_file)
{
WARN_ALREADY_INITIATED (context);
sn_free (context->application_id);
context->application_id = sn_internal_strdup (desktop_file);
}
void
sn_launcher_context_set_extra_property (SnLauncherContext *context,
const char *name,
const char *value)
{
WARN_ALREADY_INITIATED (context);
/* FIXME implement this */
}
void
sn_launcher_context_get_initiated_time (SnLauncherContext *context,
long *tv_sec,
long *tv_usec)
{
if (context->startup_id == NULL)
{
fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
"sn_launcher_context_get_initiated_time");
return;
}
if (tv_sec)
*tv_sec = context->initiation_time.tv_sec;
if (tv_usec)
*tv_usec = context->initiation_time.tv_usec;
}
void
sn_launcher_context_get_last_active_time (SnLauncherContext *context,
long *tv_sec,
long *tv_usec)
{
if (context->startup_id == NULL)
{
fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
"sn_launcher_context_get_initiated_time");
return;
}
/* for now, maybe forever, the same as initiated time. */
if (tv_sec)
*tv_sec = context->initiation_time.tv_sec;
if (tv_usec)
*tv_usec = context->initiation_time.tv_usec;
}

82
libsn/sn-launcher.h Normal file
View File

@ -0,0 +1,82 @@
/* Launcher API - if you are a program that starts other programs */
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_LAUNCHER_H__
#define __SN_LAUNCHER_H__
#include <libsn/sn-common.h>
SN_BEGIN_DECLS
typedef struct SnLauncherContext SnLauncherContext;
SnLauncherContext* sn_launcher_context_new (SnDisplay *display,
int screen);
void sn_launcher_context_ref (SnLauncherContext *context);
void sn_launcher_context_unref (SnLauncherContext *context);
void sn_launcher_context_initiate (SnLauncherContext *context,
const char *launcher_name,
const char *launchee_name,
Time timestamp);
void sn_launcher_context_complete (SnLauncherContext *context);
const char* sn_launcher_context_get_startup_id (SnLauncherContext *context);
sn_bool_t sn_launcher_context_get_initiated (SnLauncherContext *context);
void sn_launcher_context_setup_child_process (SnLauncherContext *context);
void sn_launcher_context_set_name (SnLauncherContext *context,
const char *name);
void sn_launcher_context_set_description (SnLauncherContext *context,
const char *description);
void sn_launcher_context_set_workspace (SnLauncherContext *context,
int workspace);
void sn_launcher_context_set_wmclass (SnLauncherContext *context,
const char *klass);
void sn_launcher_context_set_binary_name (SnLauncherContext *context,
const char *name);
void sn_launcher_context_set_icon_name (SnLauncherContext *context,
const char *name);
void sn_launcher_context_set_application_id (SnLauncherContext *context,
const char *desktop_file);
void sn_launcher_context_set_extra_property (SnLauncherContext *context,
const char *name,
const char *value);
void sn_launcher_context_get_initiated_time (SnLauncherContext *context,
long *tv_sec,
long *tv_usec);
void sn_launcher_context_get_last_active_time (SnLauncherContext *context,
long *tv_sec,
long *tv_usec);
SN_END_DECLS
#endif /* __SN_LAUNCHER_H__ */

168
libsn/sn-list.c Normal file
View File

@ -0,0 +1,168 @@
/* List abstraction used internally */
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "sn-list.h"
#include "sn-internals.h"
typedef struct SnListNode
{
void *data;
struct SnListNode *next;
} SnListNode;
struct SnList
{
SnListNode *head;
};
static SnListNode*
sn_list_node_alloc (void)
{
return sn_new0 (SnListNode, 1);
}
SnList*
sn_list_new (void)
{
SnList *list;
list = sn_new (SnList, 1);
list->head = NULL;
return list;
}
void
sn_list_free (SnList *list)
{
SnListNode *node;
node = list->head;
while (node != NULL)
{
SnListNode *next = node->next;
sn_free (node);
node = next;
}
sn_free (list);
}
void
sn_list_prepend (SnList *list,
void *data)
{
if (list->head == NULL)
{
list->head = sn_list_node_alloc ();
list->head->data = data;
}
else
{
SnListNode *node;
node = sn_list_node_alloc ();
node->data = data;
node->next = list->head;
list->head = node;
}
}
void
sn_list_append (SnList *list,
void *data)
{
if (list->head == NULL)
{
list->head = sn_list_node_alloc ();
list->head->data = data;
}
else
{
SnListNode *node;
node = list->head;
while (node->next != NULL)
node = node->next;
node->next = sn_list_node_alloc ();
node->next->data = data;
}
}
void
sn_list_remove (SnList *list,
void *data)
{
SnListNode *node;
SnListNode *prev;
prev = NULL;
node = list->head;
while (node != NULL)
{
if (node->data == data)
{
if (prev)
prev->next = node->next;
else
list->head = node->next;
sn_free (node);
return;
}
prev = node;
node = node->next;
}
}
void
sn_list_foreach (SnList *list,
SnListForeachFunc func,
void *data)
{
SnListNode *node;
node = list->head;
while (node != NULL)
{
SnListNode *next = node->next; /* reentrancy safety */
if (!(* func) (node->data, data))
return;
node = next;
}
}
sn_bool_t
sn_list_empty (SnList *list)
{
return list->head == NULL;
}

55
libsn/sn-list.h Normal file
View File

@ -0,0 +1,55 @@
/* List abstraction used internally */
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_LIST_H__
#define __SN_LIST_H__
#include <libsn/sn-util.h>
SN_BEGIN_DECLS
/* FIXME use sn_internal prefix for all this */
typedef struct SnList SnList;
typedef sn_bool_t (* SnListForeachFunc) (void *value, void *data);
SnList* sn_list_new (void);
void sn_list_free (SnList *list);
void sn_list_prepend (SnList *list,
void *data);
void sn_list_append (SnList *list,
void *data);
void sn_list_remove (SnList *list,
void *data);
void sn_list_foreach (SnList *list,
SnListForeachFunc func,
void *data);
sn_bool_t sn_list_empty (SnList *list);
SN_END_DECLS
#endif /* __SN_LIST_H__ */

929
libsn/sn-monitor.c Normal file
View File

@ -0,0 +1,929 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "sn-monitor.h"
#include "sn-internals.h"
#include "sn-xmessages.h"
#include <sys/time.h>
struct SnMonitorContext
{
int refcount;
SnDisplay *display;
int screen;
SnMonitorEventFunc event_func;
void *event_func_data;
SnFreeFunc free_data_func;
/* a context doesn't get events for sequences
* started prior to context creation
*/
int creation_serial;
};
struct SnMonitorEvent
{
int refcount;
SnMonitorEventType type;
SnMonitorContext *context;
SnStartupSequence *sequence;
};
struct SnStartupSequence
{
int refcount;
SnDisplay *display;
int screen;
char *id;
char *name;
char *description;
char *wmclass;
int workspace;
Time timestamp;
char *binary_name;
char *icon_name;
char *application_id;
unsigned int completed : 1;
unsigned int canceled : 1;
unsigned int timestamp_set : 1;
int creation_serial;
struct timeval initiation_time;
};
static SnList *context_list = NULL;
static SnList *sequence_list = NULL;
static int next_sequence_serial = 0;
static void xmessage_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data);
/**
* sn_monitor_context_new:
* @display: an #SnDisplay
* @screen: an X screen number
* @event_func: function to call when an event is received
* @event_func_data: extra data to pass to @event_func
* @free_data_func: function to free @event_func_data when the context is freed
*
* Creates a new context for monitoring startup sequences. Normally
* only launch feedback indicator applications such as the window
* manager or task manager would use #SnMonitorContext.
* #SnLauncherContext and #SnLauncheeContext are more often used by
* applications.
*
* To detect startup sequence initiations, PropertyChangeMask must be
* selected on all root windows for a display. libsn does not do this
* for you because it's pretty likely to mess something up. So you
* have to do it yourself in programs that use #SnMonitorContext.
*
* Return value: a new #SnMonitorContext
**/
SnMonitorContext*
sn_monitor_context_new (SnDisplay *display,
int screen,
SnMonitorEventFunc event_func,
void *event_func_data,
SnFreeFunc free_data_func)
{
SnMonitorContext *context;
context = sn_new0 (SnMonitorContext, 1);
context->refcount = 1;
context->event_func = event_func;
context->event_func_data = event_func_data;
context->free_data_func = free_data_func;
context->display = display;
sn_display_ref (context->display);
context->screen = screen;
if (context_list == NULL)
context_list = sn_list_new ();
if (sn_list_empty (context_list))
sn_internal_add_xmessage_func (display,
screen,
"_NET_STARTUP_INFO",
"_NET_STARTUP_INFO_BEGIN",
xmessage_func,
NULL, NULL);
sn_list_prepend (context_list, context);
/* We get events for serials >= creation_serial */
context->creation_serial = next_sequence_serial;
return context;
}
/**
* sn_monitor_context_ref:
* @context: an #SnMonitorContext
*
* Increments the reference count on @context.
*
**/
void
sn_monitor_context_ref (SnMonitorContext *context)
{
context->refcount += 1;
}
/**
* sn_monitor_context_unref:
* @context: an #SnMonitorContext
*
* Decrements the reference count on @context and frees the
* context if the count reaches 0.
**/
void
sn_monitor_context_unref (SnMonitorContext *context)
{
context->refcount -= 1;
if (context->refcount == 0)
{
sn_list_remove (context_list, context);
if (sn_list_empty (context_list))
sn_internal_remove_xmessage_func (context->display,
context->screen,
"_NET_STARTUP_INFO",
xmessage_func,
NULL);
if (context->free_data_func)
(* context->free_data_func) (context->event_func_data);
sn_display_unref (context->display);
sn_free (context);
}
}
void
sn_monitor_event_ref (SnMonitorEvent *event)
{
event->refcount += 1;
}
void
sn_monitor_event_unref (SnMonitorEvent *event)
{
event->refcount -= 1;
if (event->refcount == 0)
{
if (event->context)
sn_monitor_context_unref (event->context);
if (event->sequence)
sn_startup_sequence_unref (event->sequence);
sn_free (event);
}
}
SnMonitorEvent*
sn_monitor_event_copy (SnMonitorEvent *event)
{
SnMonitorEvent *copy;
copy = sn_new0 (SnMonitorEvent, 1);
copy->refcount = 1;
copy->type = event->type;
copy->context = event->context;
if (copy->context)
sn_monitor_context_ref (copy->context);
copy->sequence = event->sequence;
if (copy->sequence)
sn_startup_sequence_ref (copy->sequence);
return copy;
}
SnMonitorEventType
sn_monitor_event_get_type (SnMonitorEvent *event)
{
return event->type;
}
SnStartupSequence*
sn_monitor_event_get_startup_sequence (SnMonitorEvent *event)
{
return event->sequence;
}
SnMonitorContext*
sn_monitor_event_get_context (SnMonitorEvent *event)
{
return event->context;
}
void
sn_startup_sequence_ref (SnStartupSequence *sequence)
{
sequence->refcount += 1;
}
void
sn_startup_sequence_unref (SnStartupSequence *sequence)
{
sequence->refcount -= 1;
if (sequence->refcount == 0)
{
sn_free (sequence->id);
sn_free (sequence->name);
sn_free (sequence->description);
sn_free (sequence->wmclass);
sn_free (sequence->binary_name);
sn_free (sequence->icon_name);
sn_free (sequence->application_id);
sn_display_unref (sequence->display);
sn_free (sequence);
}
}
const char*
sn_startup_sequence_get_id (SnStartupSequence *sequence)
{
return sequence->id;
}
sn_bool_t
sn_startup_sequence_get_completed (SnStartupSequence *sequence)
{
return sequence->completed;
}
const char*
sn_startup_sequence_get_name (SnStartupSequence *sequence)
{
return sequence->name;
}
const char*
sn_startup_sequence_get_description (SnStartupSequence *sequence)
{
return sequence->description;
}
int
sn_startup_sequence_get_workspace (SnStartupSequence *sequence)
{
return sequence->workspace;
}
Time
sn_startup_sequence_get_timestamp (SnStartupSequence *sequence)
{
if (!sequence->timestamp_set)
{
fprintf (stderr,
"libsn: Buggy startup-notification launcher! No timestamp!\n");
/* Unfortunately, all values are valid; let's just return -1 */
return -1;
}
else
return sequence->timestamp;
}
const char*
sn_startup_sequence_get_wmclass (SnStartupSequence *sequence)
{
return sequence->wmclass;
}
const char*
sn_startup_sequence_get_binary_name (SnStartupSequence *sequence)
{
return sequence->binary_name;
}
const char*
sn_startup_sequence_get_icon_name (SnStartupSequence *sequence)
{
return sequence->icon_name;
}
const char*
sn_startup_sequence_get_application_id (SnStartupSequence *sequence)
{
return sequence->application_id;
}
int
sn_startup_sequence_get_screen (SnStartupSequence *sequence)
{
return sequence->screen;
}
/**
* sn_startup_sequence_get_initiated_time:
* @sequence: an #SnStartupSequence
* @tv_sec: seconds as in struct timeval
* @tv_usec: microseconds as struct timeval
*
* When a startup sequence is first monitored, libstartup-notification
* calls gettimeofday() and records the time, this function
* returns that recorded time.
*
**/
void
sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
long *tv_sec,
long *tv_usec)
{
if (tv_sec)
*tv_sec = sequence->initiation_time.tv_sec;
if (tv_usec)
*tv_usec = sequence->initiation_time.tv_usec;
}
/**
* sn_startup_sequence_get_last_active_time:
* @sequence: an #SnStartupSequence
* @tv_sec: seconds as in struct timeval
* @tv_usec: microseconds as in struct timeval
*
* Returns the last time we had evidence the startup was active.
* This function should be used to decide whether a sequence
* has timed out.
*
**/
void
sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
long *tv_sec,
long *tv_usec)
{
/* for now the same as get_initiated_time */
if (tv_sec)
*tv_sec = sequence->initiation_time.tv_sec;
if (tv_usec)
*tv_usec = sequence->initiation_time.tv_usec;
}
void
sn_startup_sequence_complete (SnStartupSequence *sequence)
{
char *keys[2];
char *vals[2];
char *message;
if (sequence->id == NULL)
return;
if (sequence->screen < 0)
return;
keys[0] = "ID";
keys[1] = NULL;
vals[0] = sequence->id;
vals[1] = NULL;
message = sn_internal_serialize_message ("remove",
(const char**) keys,
(const char **) vals);
sn_internal_broadcast_xmessage (sequence->display,
sequence->screen,
sn_internal_get_net_startup_info_atom(sequence->display),
sn_internal_get_net_startup_info_begin_atom(sequence->display),
message);
sn_free (message);
}
static SnStartupSequence*
sn_startup_sequence_new (SnDisplay *display)
{
SnStartupSequence *sequence;
sequence = sn_new0 (SnStartupSequence, 1);
sequence->refcount = 1;
sequence->creation_serial = next_sequence_serial;
++next_sequence_serial;
sequence->id = NULL;
sequence->display = display;
sn_display_ref (display);
sequence->screen = -1; /* not set */
sequence->workspace = -1; /* not set */
sequence->timestamp = 0;
sequence->timestamp_set = FALSE;
sequence->initiation_time.tv_sec = 0;
sequence->initiation_time.tv_usec = 0;
gettimeofday (&sequence->initiation_time, NULL);
return sequence;
}
typedef struct
{
SnMonitorEvent *base_event;
SnList *events;
} CreateContextEventsData;
static sn_bool_t
create_context_events_foreach (void *value,
void *data)
{
/* Make a list of events holding a ref to the context they'll go to,
* for reentrancy robustness
*/
SnMonitorContext *context = value;
CreateContextEventsData *ced = data;
/* Don't send events for startup sequences initiated before the
* context was created
*/
if (ced->base_event->sequence->creation_serial >=
context->creation_serial)
{
SnMonitorEvent *copy;
copy = sn_monitor_event_copy (ced->base_event);
copy->context = context;
sn_monitor_context_ref (copy->context);
sn_list_prepend (ced->events, copy);
}
return TRUE;
}
static sn_bool_t
dispatch_event_foreach (void *value,
void *data)
{
SnMonitorEvent *event = value;
/* Dispatch and free events */
if (event->context->event_func)
(* event->context->event_func) (event,
event->context->event_func_data);
sn_monitor_event_unref (event);
return TRUE;
}
static sn_bool_t
filter_event (SnMonitorEvent *event)
{
sn_bool_t retval;
retval = FALSE;
/* Filter out duplicate events and update flags */
switch (event->type)
{
case SN_MONITOR_EVENT_CANCELED:
if (event->sequence->canceled)
{
retval = TRUE;
}
else
{
event->sequence->canceled = TRUE;
}
break;
case SN_MONITOR_EVENT_COMPLETED:
if (event->sequence->completed)
{
retval = TRUE;
}
else
{
event->sequence->completed = TRUE;
}
break;
default:
break;
}
return retval;
}
static SnStartupSequence*
add_sequence (SnDisplay *display)
{
SnStartupSequence *sequence;
sequence =
sn_startup_sequence_new (display);
if (sequence)
{
sn_startup_sequence_ref (sequence); /* ref held by sequence list */
if (sequence_list == NULL)
sequence_list = sn_list_new ();
sn_list_prepend (sequence_list, sequence);
}
return sequence;
}
static void
remove_sequence (SnStartupSequence *sequence)
{
sn_list_remove (sequence_list, sequence);
sn_startup_sequence_unref (sequence);
}
static void
dispatch_monitor_event (SnDisplay *display,
SnMonitorEvent *event)
{
if (event->type == SN_MONITOR_EVENT_INITIATED)
{
if (event->sequence == NULL)
event->sequence = add_sequence (display);
}
if (event->sequence != NULL &&
!filter_event (event))
{
CreateContextEventsData cced;
cced.base_event = event;
cced.events = sn_list_new ();
sn_list_foreach (context_list, create_context_events_foreach,
&cced);
sn_list_foreach (cced.events, dispatch_event_foreach, NULL);
/* values in the events list freed on dispatch */
sn_list_free (cced.events);
/* remove from sequence list */
if (event->type == SN_MONITOR_EVENT_COMPLETED)
remove_sequence (event->sequence);
}
}
sn_bool_t
sn_internal_monitor_process_event (SnDisplay *display)
{
sn_bool_t retval;
if (context_list == NULL ||
sn_list_empty (context_list))
return FALSE; /* no one cares */
retval = FALSE;
return retval;
}
typedef struct
{
SnDisplay *display;
const char *id;
SnStartupSequence *found;
} FindSequenceByIdData;
static sn_bool_t
find_sequence_by_id_foreach (void *value,
void *data)
{
SnStartupSequence *sequence = value;
FindSequenceByIdData *fsd = data;
if (strcmp (sequence->id, fsd->id) == 0 &&
sn_internal_display_get_id (sequence->display) ==
sn_internal_display_get_id (fsd->display))
{
fsd->found = sequence;
return FALSE;
}
return TRUE;
}
static SnStartupSequence*
find_sequence_for_id (SnDisplay *display,
const char *id)
{
FindSequenceByIdData fsd;
if (sequence_list == NULL)
return NULL;
fsd.display = display;
fsd.id = id;
fsd.found = NULL;
sn_list_foreach (sequence_list, find_sequence_by_id_foreach, &fsd);
return fsd.found;
}
static sn_bool_t
do_xmessage_event_foreach (void *value,
void *data)
{
SnMonitorEvent *event = value;
SnDisplay *display = data;
dispatch_monitor_event (display, event);
return TRUE;
}
static sn_bool_t
unref_event_foreach (void *value,
void *data)
{
sn_monitor_event_unref (value);
return TRUE;
}
static void
xmessage_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data)
{
/* assert (strcmp (message_type, KDE_STARTUP_INFO_ATOM) == 0); */
char *prefix;
char **names;
char **values;
int i;
const char *launch_id;
SnStartupSequence *sequence;
SnList *events;
prefix = NULL;
names = NULL;
values = NULL;
if (!sn_internal_unserialize_message (message, &prefix, &names, &values))
return;
launch_id = NULL;
i = 0;
while (names[i])
{
if (strcmp (names[i], "ID") == 0)
{
launch_id = values[i];
break;
}
++i;
}
events = sn_list_new ();
if (launch_id == NULL)
goto out;
sequence = find_sequence_for_id (display, launch_id);
if (strcmp (prefix, "new") == 0)
{
if (sequence == NULL)
{
SnMonitorEvent *event;
char *time_str;
sequence = add_sequence (display);
if (sequence == NULL)
goto out;
sequence->id = sn_internal_strdup (launch_id);
/* Current spec says timestamp is part of the startup id; so we need
* to get the timestamp here if the launcher is using the current spec
*/
time_str = sn_internal_find_last_occurrence (sequence->id, "_TIME");
if (time_str != NULL)
{
/* Skip past the "_TIME" part */
time_str += 5;
sequence->timestamp = sn_internal_string_to_ulong (time_str);
sequence->timestamp_set = TRUE;
}
event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
event->type = SN_MONITOR_EVENT_INITIATED;
event->context = NULL;
event->sequence = sequence; /* ref from add_sequence goes here */
sn_list_append (events, event);
}
}
if (sequence == NULL)
goto out;
if (strcmp (prefix, "change") == 0 ||
strcmp (prefix, "new") == 0)
{
sn_bool_t changed = FALSE;
i = 0;
while (names[i])
{
if (strcmp (names[i], "BIN") == 0)
{
if (sequence->binary_name == NULL)
{
sequence->binary_name = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
else if (strcmp (names[i], "NAME") == 0)
{
if (sequence->name == NULL)
{
sequence->name = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
else if (strcmp (names[i], "SCREEN") == 0)
{
if (sequence->screen < 0)
{
int n;
n = atoi (values[i]);
if (n >= 0 && n < sn_internal_display_get_screen_number (sequence->display))
{
sequence->screen = n;
changed = TRUE;
}
}
}
else if (strcmp (names[i], "DESCRIPTION") == 0)
{
if (sequence->description == NULL)
{
sequence->description = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
else if (strcmp (names[i], "ICON") == 0)
{
if (sequence->icon_name == NULL)
{
sequence->icon_name = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
else if (strcmp (names[i], "APPLICATION_ID") == 0)
{
if (sequence->application_id == NULL)
{
sequence->application_id = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
else if (strcmp (names[i], "DESKTOP") == 0)
{
int workspace;
workspace = sn_internal_string_to_ulong (values[i]);
sequence->workspace = workspace;
changed = TRUE;
}
else if (strcmp (names[i], "TIMESTAMP") == 0 &&
!sequence->timestamp_set)
{
/* Old version of the spec says that the timestamp was
* sent as part of a TIMESTAMP message. We try to
* handle that to enable backwards compatibility with
* older launchers.
*/
Time timestamp;
timestamp = sn_internal_string_to_ulong (values[i]);
sequence->timestamp = timestamp;
sequence->timestamp_set = TRUE;
changed = TRUE;
}
else if (strcmp (names[i], "WMCLASS") == 0)
{
if (sequence->wmclass == NULL)
{
sequence->wmclass = sn_internal_strdup (values[i]);
changed = TRUE;
}
}
++i;
}
if (strcmp (prefix, "new") == 0)
{
if (sequence->screen < 0)
{
SnMonitorEvent *event;
event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
event->type = SN_MONITOR_EVENT_COMPLETED;
event->context = NULL;
event->sequence = sequence;
sn_startup_sequence_ref (sequence);
sn_list_append (events, event);
fprintf (stderr,
"Ending startup notification for %s (%s) because SCREEN "
"field was not provided; this is a bug in the launcher "
"application\n",
sequence->name ? sequence->name : "???",
sequence->binary_name ? sequence->binary_name : "???");
}
}
else if (changed)
{
SnMonitorEvent *event;
event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
event->type = SN_MONITOR_EVENT_CHANGED;
event->context = NULL;
event->sequence = sequence;
sn_startup_sequence_ref (sequence);
sn_list_append (events, event);
}
}
else if (strcmp (prefix, "remove") == 0)
{
SnMonitorEvent *event;
event = sn_new (SnMonitorEvent, 1);
event->refcount = 1;
event->type = SN_MONITOR_EVENT_COMPLETED;
event->context = NULL;
event->sequence = sequence;
sn_startup_sequence_ref (sequence);
sn_list_append (events, event);
}
sn_list_foreach (events,
do_xmessage_event_foreach,
display);
out:
if (events != NULL)
{
sn_list_foreach (events, unref_event_foreach, NULL);
sn_list_free (events);
}
sn_free (prefix);
sn_internal_strfreev (names);
sn_internal_strfreev (values);
}

90
libsn/sn-monitor.h Normal file
View File

@ -0,0 +1,90 @@
/* Monitor API - if you are a program that monitors launch sequences */
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_MONITOR_H__
#define __SN_MONITOR_H__
#include <libsn/sn-common.h>
SN_BEGIN_DECLS
typedef struct SnMonitorContext SnMonitorContext;
typedef struct SnMonitorEvent SnMonitorEvent;
typedef struct SnStartupSequence SnStartupSequence;
typedef void (* SnMonitorEventFunc) (SnMonitorEvent *event,
void *user_data);
typedef enum
{
SN_MONITOR_EVENT_INITIATED,
SN_MONITOR_EVENT_COMPLETED,
SN_MONITOR_EVENT_CHANGED,
SN_MONITOR_EVENT_CANCELED /* not used for now */
} SnMonitorEventType;
SnMonitorContext* sn_monitor_context_new (SnDisplay *display,
int screen,
SnMonitorEventFunc event_func,
void *event_func_data,
SnFreeFunc free_data_func);
void sn_monitor_context_ref (SnMonitorContext *context);
void sn_monitor_context_unref (SnMonitorContext *context);
void sn_monitor_event_ref (SnMonitorEvent *event);
void sn_monitor_event_unref (SnMonitorEvent *event);
SnMonitorEvent* sn_monitor_event_copy (SnMonitorEvent *event);
SnMonitorEventType sn_monitor_event_get_type (SnMonitorEvent *event);
SnStartupSequence* sn_monitor_event_get_startup_sequence (SnMonitorEvent *event);
SnMonitorContext* sn_monitor_event_get_context (SnMonitorEvent *event);
void sn_startup_sequence_ref (SnStartupSequence *sequence);
void sn_startup_sequence_unref (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_id (SnStartupSequence *sequence);
sn_bool_t sn_startup_sequence_get_completed (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_name (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_description (SnStartupSequence *sequence);
int sn_startup_sequence_get_workspace (SnStartupSequence *sequence);
Time sn_startup_sequence_get_timestamp (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_wmclass (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_binary_name (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_icon_name (SnStartupSequence *sequence);
const char* sn_startup_sequence_get_application_id (SnStartupSequence *sequence);
int sn_startup_sequence_get_screen (SnStartupSequence *sequence);
void sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
long *tv_sec,
long *tv_usec);
void sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
long *tv_sec,
long *tv_usec);
void sn_startup_sequence_complete (SnStartupSequence *sequence);
SN_END_DECLS
#endif /* __SN_MONITOR_H__ */

381
libsn/sn-util.c Normal file
View File

@ -0,0 +1,381 @@
/* This code derived from GLib, Copyright (C) 1997-2002
* by the GLib team.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "sn-util.h"
#include "sn-internals.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#ifndef REALLOC_0_WORKS
static void*
standard_realloc (void* mem,
sn_size_t n_bytes)
{
if (!mem)
return malloc (n_bytes);
else
return realloc (mem, n_bytes);
}
#endif /* !REALLOC_0_WORKS */
#ifdef SANE_MALLOC_PROTOS
# define standard_malloc malloc
# ifdef REALLOC_0_WORKS
# define standard_realloc realloc
# endif /* REALLOC_0_WORKS */
# define standard_free free
# define standard_calloc calloc
# define standard_try_malloc malloc
# define standard_try_realloc realloc
#else /* !SANE_MALLOC_PROTOS */
static void*
standard_malloc (sn_size_t n_bytes)
{
return malloc (n_bytes);
}
# ifdef REALLOC_0_WORKS
static void*
standard_realloc (void* mem,
sn_size_t n_bytes)
{
return realloc (mem, n_bytes);
}
# endif /* REALLOC_0_WORKS */
static void
standard_free (void* mem)
{
free (mem);
}
static void*
standard_calloc (sn_size_t n_blocks,
sn_size_t n_bytes)
{
return calloc (n_blocks, n_bytes);
}
#define standard_try_malloc standard_malloc
#define standard_try_realloc standard_realloc
#endif /* !SANE_MALLOC_PROTOS */
/* --- variables --- */
static SnMemVTable sn_mem_vtable = {
standard_malloc,
standard_realloc,
standard_free,
standard_calloc,
standard_try_malloc,
standard_try_realloc,
NULL,
NULL
};
/* --- functions --- */
void*
sn_malloc (sn_size_t n_bytes)
{
if (n_bytes)
{
void* mem;
mem = sn_mem_vtable.malloc (n_bytes);
if (mem)
return mem;
fprintf (stderr,
"libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
return NULL;
}
void*
sn_malloc0 (sn_size_t n_bytes)
{
if (n_bytes)
{
void* mem;
mem = sn_mem_vtable.calloc (1, n_bytes);
if (mem)
return mem;
fprintf (stderr,
"libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
return NULL;
}
void*
sn_realloc (void *mem,
sn_size_t n_bytes)
{
if (n_bytes)
{
mem = sn_mem_vtable.realloc (mem, n_bytes);
if (mem)
return mem;
fprintf (stderr,
"libsn: failed to allocate %lu bytes",
(unsigned long) n_bytes);
}
if (mem)
sn_mem_vtable.free (mem);
return NULL;
}
void
sn_free (void* mem)
{
if (mem)
sn_mem_vtable.free (mem);
}
void*
sn_try_malloc (sn_size_t n_bytes)
{
if (n_bytes)
return sn_mem_vtable.try_malloc (n_bytes);
else
return NULL;
}
void*
sn_try_realloc (void *mem,
sn_size_t n_bytes)
{
if (n_bytes)
return sn_mem_vtable.try_realloc (mem, n_bytes);
if (mem)
sn_mem_vtable.free (mem);
return NULL;
}
static void*
fallback_calloc (sn_size_t n_blocks,
sn_size_t n_block_bytes)
{
sn_size_t l = n_blocks * n_block_bytes;
void* mem = sn_mem_vtable.malloc (l);
if (mem)
memset (mem, 0, l);
return mem;
}
static sn_bool_t vtable_set = FALSE;
sn_bool_t
sn_mem_is_system_malloc (void)
{
return !vtable_set;
}
void
sn_mem_set_vtable (SnMemVTable *vtable)
{
if (!vtable_set)
{
vtable_set = TRUE;
if (vtable->malloc && vtable->realloc && vtable->free)
{
sn_mem_vtable.malloc = vtable->malloc;
sn_mem_vtable.realloc = vtable->realloc;
sn_mem_vtable.free = vtable->free;
sn_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc;
sn_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : sn_mem_vtable.malloc;
sn_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : sn_mem_vtable.realloc;
}
else
{
fprintf (stderr,
"libsn: memory allocation vtable lacks one of malloc(), realloc() or free()");
}
}
else
{
fprintf (stderr,
"libsn: memory allocation vtable can only be set once at startup");
}
}
static SnUtf8ValidateFunc utf8_validator = NULL;
void
sn_set_utf8_validator (SnUtf8ValidateFunc validate_func)
{
utf8_validator = validate_func;
}
sn_bool_t
sn_internal_utf8_validate (const char *str,
int max_len)
{
if (utf8_validator)
{
if (max_len < 0)
max_len = strlen (str);
return (* utf8_validator) (str, max_len);
}
else
return TRUE;
}
char*
sn_internal_strdup (const char *str)
{
char *s;
s = sn_malloc (strlen (str) + 1);
strcpy (s, str);
return s;
}
char*
sn_internal_strndup (const char *str,
int n)
{
char *new_str;
if (str)
{
new_str = sn_new (char, n + 1);
strncpy (new_str, str, n);
new_str[n] = '\0';
}
else
new_str = NULL;
return new_str;
}
void
sn_internal_strfreev (char **strings)
{
int i;
if (strings == NULL)
return;
i = 0;
while (strings[i])
{
sn_free (strings[i]);
++i;
}
sn_free (strings);
}
unsigned long
sn_internal_string_to_ulong (const char* str)
{
unsigned long retval;
char *end;
errno = 0;
retval = strtoul (str, &end, 0);
if (end == str || errno != 0)
retval = 0;
return retval;
}
/**
* sn_internal_find_last_occurrence:
* @haystack: a nul-terminated string.
* @needle: the nul-terminated string to search for.
*
* Searches the string @haystack for the last occurrence
* of the string @needle.
*
* Return value: a pointer to the found occurrence, or
* %NULL if not found.
**/
char*
sn_internal_find_last_occurrence (const char* haystack,
const char* needle)
{
int i;
int needle_len;
int haystack_len;
const char *p;
if (haystack == NULL)
return NULL;
if (needle == NULL)
return NULL;
needle_len = strlen (needle);
haystack_len = strlen (haystack);
if (needle_len == 0)
return (char *)haystack;
if (haystack_len < needle_len)
return NULL;
p = haystack + haystack_len - needle_len;
while (p >= haystack)
{
for (i = 0; i < needle_len; i++)
if (p[i] != needle[i])
goto next;
return (char *)p;
next:
p--;
}
return NULL;
}
void
sn_internal_append_to_string (char **append_to,
int *current_len,
const char *append)
{
int len;
char *end;
assert (append != NULL);
len = strlen (append);
*append_to = sn_realloc (*append_to, *current_len + len + 1);
end = *append_to + *current_len;
strcpy (end, append);
*current_len = *current_len + len;
}

97
libsn/sn-util.h Normal file
View File

@ -0,0 +1,97 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_UTIL_H__
#define __SN_UTIL_H__
/* Guard C code in headers, while including them from C++ */
#ifdef __cplusplus
# define SN_BEGIN_DECLS extern "C" {
# define SN_END_DECLS }
#else
# define SN_BEGIN_DECLS
# define SN_END_DECLS
#endif
SN_BEGIN_DECLS
typedef unsigned long sn_size_t;
typedef int sn_bool_t;
/* Padding in vtables */
typedef void (* SnPaddingFunc) (void);
/* Free data */
typedef void (* SnFreeFunc) (void *data);
void* sn_malloc (sn_size_t n_bytes);
void* sn_malloc0 (sn_size_t n_bytes);
void* sn_realloc (void *mem,
sn_size_t n_bytes);
void sn_free (void *mem);
void* sn_try_malloc (sn_size_t n_bytes);
void* sn_try_realloc (void *mem,
sn_size_t n_bytes);
/* Convenience memory allocators
*/
#define sn_new(struct_type, n_structs) \
((struct_type *) sn_malloc (((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
#define sn_new0(struct_type, n_structs) \
((struct_type *) sn_malloc0 (((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
#define sn_renew(struct_type, mem, n_structs) \
((struct_type *) sn_realloc ((mem), ((sn_size_t) sizeof (struct_type)) * ((sn_size_t) (n_structs))))
/* Memory allocation virtualization, so you can override memory
* allocation behavior. sn_mem_set_vtable() has to be the very first
* libsn function called if being used
*/
typedef struct
{
void* (*malloc) (sn_size_t n_bytes);
void* (*realloc) (void *mem,
sn_size_t n_bytes);
void (*free) (void *mem);
/* optional */
void* (*calloc) (sn_size_t n_blocks,
sn_size_t n_block_bytes);
void* (*try_malloc) (sn_size_t n_bytes);
void* (*try_realloc) (void *mem,
sn_size_t n_bytes);
SnPaddingFunc padding1;
SnPaddingFunc padding2;
} SnMemVTable;
void sn_mem_set_vtable (SnMemVTable *vtable);
sn_bool_t sn_mem_is_system_malloc (void);
typedef sn_bool_t (* SnUtf8ValidateFunc) (const char *str,
int max_len);
void sn_set_utf8_validator (SnUtf8ValidateFunc validate_func);
SN_END_DECLS
#endif /* __SN_UTIL_H__ */

779
libsn/sn-xmessages.c Normal file
View File

@ -0,0 +1,779 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include "sn-xmessages.h"
#include "sn-list.h"
#include "sn-internals.h"
typedef struct
{
void *xid;
xcb_window_t root;
xcb_atom_t type_atom;
xcb_atom_t type_atom_begin;
char *message_type;
SnXmessageFunc func;
void *func_data;
SnFreeFunc free_data_func;
} SnXmessageHandler;
typedef struct
{
xcb_atom_t type_atom_begin;
xcb_window_t xwindow;
char *message;
int allocated;
} SnXmessage;
void
sn_internal_add_xmessage_func (SnDisplay *display,
int screen,
const char *message_type,
const char *message_type_begin,
SnXmessageFunc func,
void *func_data,
SnFreeFunc free_data_func)
{
SnXmessageHandler *handler;
SnList *xmessage_funcs;
xcb_connection_t *c = sn_display_get_x_connection(display);
/* Send atom requests ASAP */
xcb_intern_atom_cookie_t message_type_c =
xcb_intern_atom(c, FALSE, strlen(message_type), message_type);
xcb_intern_atom_cookie_t message_type_begin_c =
xcb_intern_atom(c, FALSE, strlen(message_type_begin), message_type_begin);
sn_internal_display_get_xmessage_data (display, &xmessage_funcs,
NULL);
handler = sn_new0 (SnXmessageHandler, 1);
handler->xid = sn_internal_display_get_id (display);
handler->root = sn_internal_display_get_root_window (display, screen);
handler->message_type = sn_internal_strdup (message_type);
handler->func = func;
handler->func_data = func_data;
handler->free_data_func = free_data_func;
xcb_intern_atom_reply_t *atom_reply;
atom_reply = xcb_intern_atom_reply(c, message_type_c, NULL);
handler->type_atom = atom_reply->atom;
free(atom_reply);
atom_reply = xcb_intern_atom_reply(c, message_type_begin_c, NULL);
handler->type_atom_begin = atom_reply->atom;
free(atom_reply);
sn_list_prepend (xmessage_funcs, handler);
}
typedef struct
{
const char *message_type;
SnXmessageFunc func;
void *func_data;
xcb_window_t root;
SnXmessageHandler *handler;
} FindHandlerData;
static sn_bool_t
find_handler_foreach (void *value,
void *data)
{
FindHandlerData *fhd = data;
SnXmessageHandler *handler = value;
if (handler->func == fhd->func &&
handler->func_data == fhd->func_data &&
handler->root == fhd->root &&
strcmp (fhd->message_type, handler->message_type) == 0)
{
fhd->handler = handler;
return FALSE;
}
return TRUE;
}
void
sn_internal_remove_xmessage_func (SnDisplay *display,
int screen,
const char *message_type,
SnXmessageFunc func,
void *func_data)
{
FindHandlerData fhd;
SnList *xmessage_funcs;
sn_internal_display_get_xmessage_data (display, &xmessage_funcs,
NULL);
fhd.message_type = message_type;
fhd.func = func;
fhd.func_data = func_data;
fhd.handler = NULL;
fhd.root = sn_internal_display_get_root_window (display, screen);
if (xmessage_funcs != NULL)
sn_list_foreach (xmessage_funcs, find_handler_foreach, &fhd);
if (fhd.handler != NULL)
{
sn_list_remove (xmessage_funcs, fhd.handler);
sn_free (fhd.handler->message_type);
if (fhd.handler->free_data_func)
(* fhd.handler->free_data_func) (fhd.handler->func_data);
sn_free (fhd.handler);
}
}
void
sn_internal_broadcast_xmessage (SnDisplay *display,
int screen,
xcb_atom_t message_type,
xcb_atom_t message_type_begin,
const char *message)
{
if (!sn_internal_utf8_validate (message, -1))
{
fprintf (stderr,
"Attempted to send non-UTF-8 X message: %s\n",
message);
return;
}
xcb_connection_t *xconnection = sn_display_get_x_connection (display);
uint32_t attrs[] = { 1, XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY };
xcb_screen_t *s = sn_internal_display_get_x_screen (display, screen);
xcb_window_t xwindow = xcb_generate_id(xconnection);
xcb_create_window(xconnection, s->root_depth, xwindow, s->root,
-100, -100, 1, 1, 0, XCB_COPY_FROM_PARENT, s->root_visual,
XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK,
attrs);
{
xcb_client_message_event_t xevent;
const char *src;
const char *src_end;
unsigned char *dest;
unsigned char *dest_end;
xevent.response_type = XCB_CLIENT_MESSAGE;
xevent.window = xwindow;
xevent.format = 8;
xevent.type = message_type_begin;
src = message;
src_end = message + strlen (message) + 1; /* +1 to include nul byte */
while (src != src_end)
{
dest = &xevent.data.data8[0];
dest_end = dest + 20;
while (dest != dest_end &&
src != src_end)
{
*dest = *src;
++dest;
++src;
}
xcb_send_event (xconnection, 0, s->root, XCB_EVENT_MASK_PROPERTY_CHANGE,
(char *) &xevent);
xevent.type = message_type;
}
}
xcb_destroy_window (xconnection, xwindow);
xcb_flush(xconnection);
}
typedef struct
{
void *xid;
xcb_atom_t atom;
xcb_window_t xwindow;
sn_bool_t found_handler;
} HandlerForAtomData;
static sn_bool_t
handler_for_atom_foreach (void *value,
void *data)
{
SnXmessageHandler *handler = value;
HandlerForAtomData *hfad = data;
if (handler->xid == hfad->xid &&
(handler->type_atom == hfad->atom ||
handler->type_atom_begin == hfad->atom))
{
hfad->found_handler = TRUE;
return FALSE;
}
else
return TRUE;
}
static sn_bool_t
some_handler_handles_event (SnDisplay *display,
xcb_atom_t atom,
xcb_window_t win)
{
HandlerForAtomData hfad;
SnList *xmessage_funcs;
sn_internal_display_get_xmessage_data (display, &xmessage_funcs,
NULL);
hfad.atom = atom;
hfad.xid = sn_internal_display_get_id (display);
hfad.xwindow = win;
hfad.found_handler = FALSE;
if (xmessage_funcs)
sn_list_foreach (xmessage_funcs,
handler_for_atom_foreach,
&hfad);
return hfad.found_handler;
}
typedef struct
{
xcb_window_t window;
SnXmessage *message;
} FindMessageData;
static sn_bool_t
find_message_foreach (void *value,
void *data)
{
SnXmessage *message = value;
FindMessageData *fmd = data;
if (fmd->window == message->xwindow)
{
fmd->message = message;
return FALSE;
}
return TRUE;
}
static SnXmessage*
message_new(xcb_atom_t type_atom_begin, xcb_window_t win)
{
SnXmessage *message = sn_new0 (SnXmessage, 1);
message->type_atom_begin = type_atom_begin;
message->xwindow = win;
message->message = NULL;
message->allocated = 0;
return message;
}
static sn_bool_t
message_set_message(SnXmessage *message, const char *src)
{
const char *src_end;
char *dest;
sn_bool_t completed = FALSE;
src_end = src + 20;
message->message = sn_realloc (message->message,
message->allocated + (src_end - src));
dest = message->message + message->allocated;
message->allocated += (src_end - src);
/* Copy bytes, be sure we get nul byte also */
while (src != src_end)
{
*dest = *src;
if (*src == '\0')
{
completed = TRUE;
break;
}
++dest;
++src;
}
return completed;
}
static SnXmessage*
get_or_add_message(SnList *pending_messages,
xcb_window_t win,
xcb_atom_t type_atom_begin)
{
FindMessageData fmd;
SnXmessage *message;
fmd.window = win;
fmd.message = NULL;
if (pending_messages)
sn_list_foreach (pending_messages, find_message_foreach, &fmd);
message = fmd.message;
if (message == NULL)
{
message = message_new(type_atom_begin, win);
sn_list_prepend (pending_messages, message);
}
return message;
}
static SnXmessage*
add_event_to_messages (SnDisplay *display,
xcb_window_t win,
xcb_atom_t message_type,
const char *data)
{
SnXmessage *message;
SnList *pending_messages;
sn_internal_display_get_xmessage_data (display, NULL,
&pending_messages);
message = get_or_add_message(pending_messages,
win, message_type);
/* We don't want screwy situations to end up causing us to allocate
* infinite memory. Cap the length of a message.
*/
#define MAX_MESSAGE_LENGTH 4096
if (message->allocated > MAX_MESSAGE_LENGTH)
{
/* This message is some kind of crap - just dump it. */
sn_free (message->message);
sn_list_remove (pending_messages, message);
sn_free (message);
return NULL;
}
if (message_set_message (message, data))
{
/* Pull message out of the pending queue and return it */
sn_list_remove (pending_messages, message);
return message;
}
else
return NULL;
}
typedef struct
{
SnDisplay *display;
SnXmessage *message;
} MessageDispatchData;
static sn_bool_t
dispatch_message_foreach (void *value,
void *data)
{
SnXmessageHandler *handler = value;
MessageDispatchData *mdd = data;
if (handler->type_atom_begin == mdd->message->type_atom_begin &&
sn_internal_display_get_id (mdd->display) == handler->xid)
(* handler->func) (mdd->display,
handler->message_type,
mdd->message->message,
handler->func_data);
return TRUE;
}
static void
xmessage_process_message (SnDisplay *display, SnXmessage *message)
{
if (message)
{
/* We need to dispatch and free this message; ignore
* messages containing invalid UTF-8
*/
if (sn_internal_utf8_validate (message->message, -1))
{
MessageDispatchData mdd;
SnList *xmessage_funcs;
sn_internal_display_get_xmessage_data (display, &xmessage_funcs,
NULL);
mdd.display = display;
mdd.message = message;
/* We could stand to be more reentrant here; it will
* barf if you add/remove a handler from inside the
* dispatch
*/
if (xmessage_funcs != NULL)
sn_list_foreach (xmessage_funcs,
dispatch_message_foreach,
&mdd);
}
else
{
/* FIXME don't use fprintf, use something pluggable */
fprintf (stderr, "Bad UTF-8 in startup notification message\n");
}
sn_free (message->message);
sn_free (message);
}
}
sn_bool_t
sn_internal_xmessage_process_client_message (SnDisplay *display,
xcb_window_t window,
xcb_atom_t type,
const char *data)
{
sn_bool_t retval = FALSE;
SnXmessage *message = NULL;
if (some_handler_handles_event (display, type, window))
{
retval = TRUE;
message = add_event_to_messages (display, window, type, data);
}
xmessage_process_message (display, message);
return retval;
}
static void
sn_internal_append_to_string_escaped (char **append_to,
int *current_len,
const char *append)
{
char *escaped;
int len;
char buf[2];
const char *p;
buf[1] = '\0';
len = 0;
escaped = NULL;
/* We are the most inefficient algorithm ever! woot! */
/* really need GString here */
p = append;
while (*p)
{
if (*p == '\\' || *p == '"' || *p == ' ')
{
buf[0] = '\\';
sn_internal_append_to_string (&escaped, &len, buf);
}
buf[0] = *p;
sn_internal_append_to_string (&escaped, &len, buf);
++p;
}
if (escaped != NULL)
{
sn_internal_append_to_string (append_to, current_len, escaped);
sn_free (escaped);
}
}
char*
sn_internal_serialize_message (const char *prefix,
const char **property_names,
const char **property_values)
{
int len;
char *retval;
int i;
/* GLib would simplify this a lot... */
len = 0;
retval = NULL;
sn_internal_append_to_string (&retval, &len, prefix);
sn_internal_append_to_string (&retval, &len, ":");
i = 0;
while (property_names[i])
{
sn_internal_append_to_string (&retval, &len, " ");
sn_internal_append_to_string (&retval, &len, property_names[i]);
sn_internal_append_to_string (&retval, &len, "=");
sn_internal_append_to_string_escaped (&retval, &len, property_values[i]);
++i;
}
return retval;
}
/* Takes ownership of @append
*/
static void
append_string_to_list (char ***list,
char *append)
{
if (*list == NULL)
{
*list = sn_new0 (char*, 2);
(*list)[0] = append;
}
else
{
int i;
i = 0;
while ((*list)[i] != NULL)
++i;
*list = sn_renew (char*, *list, i + 2);
(*list)[i] = append;
(*list)[i+1] = NULL;
}
}
static char*
parse_prefix_up_to (const char *str,
int up_to,
const char **end)
{
char *prefix;
const char *p;
int len;
prefix = NULL;
*end = NULL;
p = str;
while (*p && *p != up_to)
++p;
if (*p == '\0')
return NULL;
len = p - str;
prefix = sn_internal_strndup (str, len);
*end = str + len;
return prefix;
}
/* Single quotes preserve the literal string exactly. escape
* sequences are not allowed; not even \' - if you want a '
* in the quoted text, you have to do something like 'foo'\''bar'
*
* Double quotes allow $ ` " \ and newline to be escaped with backslash.
* Otherwise double quotes preserve things literally.
*
* (This is overkill for X messages, copied from GLib shell code,
* copyright Red Hat Inc. also)
*/
static sn_bool_t
unescape_string_inplace (char *str,
char **end)
{
char* dest;
char* s;
sn_bool_t escaped;
sn_bool_t quoted;
dest = s = str;
escaped = FALSE;
quoted = FALSE;
while (*s)
{
if (escaped)
{
escaped = FALSE;
*dest = *s;
++dest;
}
else if (quoted)
{
if (*s == '"')
quoted = FALSE;
else if (*s == '\\')
escaped = TRUE;
else
{
*dest = *s;
++dest;
}
}
else
{
if (*s == ' ')
break;
else if (*s == '\\')
escaped = TRUE;
else if (*s == '"')
quoted = TRUE;
else
{
*dest = *s;
++dest;
}
}
++s;
}
*dest = '\0';
*end = s;
return TRUE;
}
static sn_bool_t
parse_property (const char *str,
char **name_p,
char **val_p,
const char **end_p)
{
char *val;
char *name;
char *copy;
char *p;
*end_p = NULL;
copy = sn_internal_strdup (str);
p = copy;
while (*p == ' ')
++p;
name = parse_prefix_up_to (p, '=', (const char**) &p);
if (name == NULL)
{
sn_free (copy);
return FALSE;
}
++p; /* skip '=' */
while (*p == ' ')
++p;
{
char *end;
end = NULL;
if (!unescape_string_inplace (p, &end))
{
sn_free (copy);
sn_free (name);
return FALSE;
}
val = sn_internal_strndup (p, end - p);
p = end;
}
while (*p == ' ')
++p;
*end_p = str + (p - copy);
sn_free (copy);
*name_p = name;
*val_p = val;
return TRUE;
}
sn_bool_t
sn_internal_unserialize_message (const char *message,
char **prefix_p,
char ***property_names,
char ***property_values)
{
/* GLib would simplify this a lot... */
char *prefix;
char **names;
char **values;
const char *p;
char *name;
char *value;
*prefix_p = NULL;
*property_names = NULL;
*property_values = NULL;
prefix = NULL;
names = NULL;
values = NULL;
prefix = parse_prefix_up_to (message, ':', &p);
if (prefix == NULL)
return FALSE;
++p; /* skip ':' */
name = NULL;
value = NULL;
while (parse_property (p, &name, &value, &p))
{
append_string_to_list (&names, name);
append_string_to_list (&values, value);
}
*prefix_p = prefix;
*property_names = names;
*property_values = values;
return TRUE;
}

65
libsn/sn-xmessages.h Normal file
View File

@ -0,0 +1,65 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_XMESSAGES_H__
#define __SN_XMESSAGES_H__
#include <libsn/sn-common.h>
SN_BEGIN_DECLS
typedef void (* SnXmessageFunc) (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data);
void sn_internal_add_xmessage_func (SnDisplay *display,
int screen,
const char *message_type,
const char *message_type_begin,
SnXmessageFunc func,
void *func_data,
SnFreeFunc free_data_func);
void sn_internal_remove_xmessage_func (SnDisplay *display,
int screen,
const char *message_type,
SnXmessageFunc func,
void *func_data);
void sn_internal_broadcast_xmessage (SnDisplay *display,
int screen,
xcb_atom_t message_type,
xcb_atom_t message_type_begin,
const char *message);
char* sn_internal_serialize_message (const char *prefix,
const char **property_names,
const char **property_values);
sn_bool_t sn_internal_unserialize_message (const char *message,
char **prefix,
char ***property_names,
char ***property_values);
SN_END_DECLS
#endif /* __SN_XMESSAGES_H__ */

49
libsn/sn-xutils.c Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include "sn-internals.h"
#include <xcb/xcb.h>
void
sn_internal_set_utf8_string (SnDisplay *display,
xcb_window_t xwindow,
xcb_atom_t property,
const char *str)
{
sn_display_error_trap_push (display);
xcb_connection_t *c = sn_display_get_x_connection (display);
xcb_atom_t UTF8_STRING = sn_internal_get_utf8_string_atom(display);
xcb_change_property (c,
XCB_PROP_MODE_REPLACE,
xwindow,
property,
UTF8_STRING,
8, strlen (str), str);
sn_display_error_trap_pop (display);
}

40
libsn/sn-xutils.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_XUTILS_H__
#define __SN_XUTILS_H__
#include <libsn/sn-common.h>
SN_BEGIN_DECLS
void sn_internal_set_utf8_string (SnDisplay *display,
xcb_window_t xwindow,
xcb_atom_t property,
const char *str);
SN_END_DECLS
#endif /* __SN_XUTILS_H__ */

36
libsn/sn.h Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __SN_SN_H__
#define __SN_SN_H__
/* Convenience header that includes all the other headers */
#include <libsn/sn-launchee.h>
#include <libsn/sn-launcher.h>
#include <libsn/sn-monitor.h>
#endif /* __SN_SN_H__ */

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libstartup-notification
Description: Startup notification library
Version: @VERSION@
Libs: -L${libdir} -lstartup-notification-1
Cflags: -I${includedir}/startup-notification-1.0

9642
ltmain.sh Executable file

File diff suppressed because it is too large Load Diff

376
missing Executable file
View File

@ -0,0 +1,376 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

61
test/Makefile.am Normal file
View File

@ -0,0 +1,61 @@
INCLUDES=$(LIBSN_CFLAGS) -I$(top_srcdir) -DSN_API_NOT_YET_FROZEN=1
XLIB_TEST= \
test-launcher \
test-launchee \
test-monitor \
test-send-xmessage \
test-watch-xmessages
XCB_TEST= \
test-send-xmessage-xcb \
test-monitor-xcb \
test-launchee-xcb \
test-launcher-xcb \
test-watch-xmessages-xcb
check_PROGRAMS=$(XLIB_TEST) $(XCB_TEST)
test_launcher_SOURCES= test-launcher.c
test_launcher_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launchee_SOURCES= test-launchee.c
test_launchee_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_monitor_SOURCES= test-monitor.c
test_monitor_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_send_xmessage_SOURCES= test-send-xmessage.c
test_send_xmessage_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_watch_xmessages_SOURCES= test-watch-xmessages.c
test_watch_xmessages_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_watch_xmessages_xcb_SOURCES= test-watch-xmessages-xcb.c
test_watch_xmessages_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_send_xmessage_xcb_SOURCES= test-send-xmessage-xcb.c
test_send_xmessage_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_monitor_xcb_SOURCES= test-monitor-xcb.c
test_monitor_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launchee_xcb_SOURCES= test-launchee-xcb.c
test_launchee_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launcher_xcb_SOURCES= test-launcher-xcb.c
test_launcher_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
EXTRA_DIST=test-boilerplate.h

616
test/Makefile.in Normal file
View File

@ -0,0 +1,616 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
subdir = test
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = test-launcher$(EXEEXT) test-launchee$(EXEEXT) \
test-monitor$(EXEEXT) test-send-xmessage$(EXEEXT) \
test-watch-xmessages$(EXEEXT)
am__EXEEXT_2 = test-send-xmessage-xcb$(EXEEXT) \
test-monitor-xcb$(EXEEXT) test-launchee-xcb$(EXEEXT) \
test-launcher-xcb$(EXEEXT) test-watch-xmessages-xcb$(EXEEXT)
am_test_launchee_OBJECTS = test-launchee.$(OBJEXT)
test_launchee_OBJECTS = $(am_test_launchee_OBJECTS)
am__DEPENDENCIES_1 =
test_launchee_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_launchee_xcb_OBJECTS = test-launchee-xcb.$(OBJEXT)
test_launchee_xcb_OBJECTS = $(am_test_launchee_xcb_OBJECTS)
test_launchee_xcb_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_launcher_OBJECTS = test-launcher.$(OBJEXT)
test_launcher_OBJECTS = $(am_test_launcher_OBJECTS)
test_launcher_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_launcher_xcb_OBJECTS = test-launcher-xcb.$(OBJEXT)
test_launcher_xcb_OBJECTS = $(am_test_launcher_xcb_OBJECTS)
test_launcher_xcb_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_monitor_OBJECTS = test-monitor.$(OBJEXT)
test_monitor_OBJECTS = $(am_test_monitor_OBJECTS)
test_monitor_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_monitor_xcb_OBJECTS = test-monitor-xcb.$(OBJEXT)
test_monitor_xcb_OBJECTS = $(am_test_monitor_xcb_OBJECTS)
test_monitor_xcb_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_send_xmessage_OBJECTS = test-send-xmessage.$(OBJEXT)
test_send_xmessage_OBJECTS = $(am_test_send_xmessage_OBJECTS)
test_send_xmessage_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_send_xmessage_xcb_OBJECTS = test-send-xmessage-xcb.$(OBJEXT)
test_send_xmessage_xcb_OBJECTS = $(am_test_send_xmessage_xcb_OBJECTS)
test_send_xmessage_xcb_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_watch_xmessages_OBJECTS = test-watch-xmessages.$(OBJEXT)
test_watch_xmessages_OBJECTS = $(am_test_watch_xmessages_OBJECTS)
test_watch_xmessages_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
am_test_watch_xmessages_xcb_OBJECTS = \
test-watch-xmessages-xcb.$(OBJEXT)
test_watch_xmessages_xcb_OBJECTS = \
$(am_test_watch_xmessages_xcb_OBJECTS)
test_watch_xmessages_xcb_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(top_builddir)/libsn/libstartup-notification-1.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(test_launchee_SOURCES) $(test_launchee_xcb_SOURCES) \
$(test_launcher_SOURCES) $(test_launcher_xcb_SOURCES) \
$(test_monitor_SOURCES) $(test_monitor_xcb_SOURCES) \
$(test_send_xmessage_SOURCES) \
$(test_send_xmessage_xcb_SOURCES) \
$(test_watch_xmessages_SOURCES) \
$(test_watch_xmessages_xcb_SOURCES)
DIST_SOURCES = $(test_launchee_SOURCES) $(test_launchee_xcb_SOURCES) \
$(test_launcher_SOURCES) $(test_launcher_xcb_SOURCES) \
$(test_monitor_SOURCES) $(test_monitor_xcb_SOURCES) \
$(test_send_xmessage_SOURCES) \
$(test_send_xmessage_xcb_SOURCES) \
$(test_watch_xmessages_SOURCES) \
$(test_watch_xmessages_xcb_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSN_CFLAGS = @LIBSN_CFLAGS@
LIBSN_LIBS = @LIBSN_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
x11_xcb_CFLAGS = @x11_xcb_CFLAGS@
x11_xcb_LIBS = @x11_xcb_LIBS@
xcb_CFLAGS = @xcb_CFLAGS@
xcb_LIBS = @xcb_LIBS@
xcb_aux_CFLAGS = @xcb_aux_CFLAGS@
xcb_aux_LIBS = @xcb_aux_LIBS@
xcb_event_CFLAGS = @xcb_event_CFLAGS@
xcb_event_LIBS = @xcb_event_LIBS@
INCLUDES = $(LIBSN_CFLAGS) -I$(top_srcdir) -DSN_API_NOT_YET_FROZEN=1
XLIB_TEST = \
test-launcher \
test-launchee \
test-monitor \
test-send-xmessage \
test-watch-xmessages
XCB_TEST = \
test-send-xmessage-xcb \
test-monitor-xcb \
test-launchee-xcb \
test-launcher-xcb \
test-watch-xmessages-xcb
test_launcher_SOURCES = test-launcher.c
test_launcher_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launchee_SOURCES = test-launchee.c
test_launchee_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_monitor_SOURCES = test-monitor.c
test_monitor_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_send_xmessage_SOURCES = test-send-xmessage.c
test_send_xmessage_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_watch_xmessages_SOURCES = test-watch-xmessages.c
test_watch_xmessages_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_watch_xmessages_xcb_SOURCES = test-watch-xmessages-xcb.c
test_watch_xmessages_xcb_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_send_xmessage_xcb_SOURCES = test-send-xmessage-xcb.c
test_send_xmessage_xcb_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_monitor_xcb_SOURCES = test-monitor-xcb.c
test_monitor_xcb_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launchee_xcb_SOURCES = test-launchee-xcb.c
test_launchee_xcb_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
test_launcher_xcb_SOURCES = test-launcher-xcb.c
test_launcher_xcb_LDADD = $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
EXTRA_DIST = test-boilerplate.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
test-launchee$(EXEEXT): $(test_launchee_OBJECTS) $(test_launchee_DEPENDENCIES)
@rm -f test-launchee$(EXEEXT)
$(LINK) $(test_launchee_OBJECTS) $(test_launchee_LDADD) $(LIBS)
test-launchee-xcb$(EXEEXT): $(test_launchee_xcb_OBJECTS) $(test_launchee_xcb_DEPENDENCIES)
@rm -f test-launchee-xcb$(EXEEXT)
$(LINK) $(test_launchee_xcb_OBJECTS) $(test_launchee_xcb_LDADD) $(LIBS)
test-launcher$(EXEEXT): $(test_launcher_OBJECTS) $(test_launcher_DEPENDENCIES)
@rm -f test-launcher$(EXEEXT)
$(LINK) $(test_launcher_OBJECTS) $(test_launcher_LDADD) $(LIBS)
test-launcher-xcb$(EXEEXT): $(test_launcher_xcb_OBJECTS) $(test_launcher_xcb_DEPENDENCIES)
@rm -f test-launcher-xcb$(EXEEXT)
$(LINK) $(test_launcher_xcb_OBJECTS) $(test_launcher_xcb_LDADD) $(LIBS)
test-monitor$(EXEEXT): $(test_monitor_OBJECTS) $(test_monitor_DEPENDENCIES)
@rm -f test-monitor$(EXEEXT)
$(LINK) $(test_monitor_OBJECTS) $(test_monitor_LDADD) $(LIBS)
test-monitor-xcb$(EXEEXT): $(test_monitor_xcb_OBJECTS) $(test_monitor_xcb_DEPENDENCIES)
@rm -f test-monitor-xcb$(EXEEXT)
$(LINK) $(test_monitor_xcb_OBJECTS) $(test_monitor_xcb_LDADD) $(LIBS)
test-send-xmessage$(EXEEXT): $(test_send_xmessage_OBJECTS) $(test_send_xmessage_DEPENDENCIES)
@rm -f test-send-xmessage$(EXEEXT)
$(LINK) $(test_send_xmessage_OBJECTS) $(test_send_xmessage_LDADD) $(LIBS)
test-send-xmessage-xcb$(EXEEXT): $(test_send_xmessage_xcb_OBJECTS) $(test_send_xmessage_xcb_DEPENDENCIES)
@rm -f test-send-xmessage-xcb$(EXEEXT)
$(LINK) $(test_send_xmessage_xcb_OBJECTS) $(test_send_xmessage_xcb_LDADD) $(LIBS)
test-watch-xmessages$(EXEEXT): $(test_watch_xmessages_OBJECTS) $(test_watch_xmessages_DEPENDENCIES)
@rm -f test-watch-xmessages$(EXEEXT)
$(LINK) $(test_watch_xmessages_OBJECTS) $(test_watch_xmessages_LDADD) $(LIBS)
test-watch-xmessages-xcb$(EXEEXT): $(test_watch_xmessages_xcb_OBJECTS) $(test_watch_xmessages_xcb_DEPENDENCIES)
@rm -f test-watch-xmessages-xcb$(EXEEXT)
$(LINK) $(test_watch_xmessages_xcb_OBJECTS) $(test_watch_xmessages_xcb_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-launchee-xcb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-launchee.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-launcher-xcb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-launcher.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-monitor-xcb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-send-xmessage-xcb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-send-xmessage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-watch-xmessages-xcb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-watch-xmessages.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

122
test/test-boilerplate.h Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL ((void*) 0)
#endif
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
static void
print_backtrace (void)
{
void *bt[500];
int bt_size;
int i;
char **syms;
bt_size = backtrace (bt, 500);
syms = backtrace_symbols (bt, bt_size);
i = 0;
while (i < bt_size)
{
fprintf (stderr, " %s\n", syms[i]);
++i;
}
free (syms);
}
#else
static void
print_backtrace (void)
{
fprintf (stderr, "Not compiled with backtrace support\n");
}
#endif
static int error_trap_depth = 0;
static int
x_error_handler (Display *xdisplay,
XErrorEvent *error)
{
char buf[64];
XGetErrorText (xdisplay, error->error_code, buf, 63);
if (error_trap_depth == 0)
{
print_backtrace ();
fprintf (stderr, "Unexpected X error: %s serial %ld error_code %d request_code %d minor_code %d)\n",
buf,
error->serial,
error->error_code,
error->request_code,
error->minor_code);
exit (1);
}
return 1; /* return value is meaningless */
}
static void
error_trap_push (SnDisplay *display,
Display *xdisplay)
{
++error_trap_depth;
}
static void
error_trap_pop (SnDisplay *display,
Display *xdisplay)
{
if (error_trap_depth == 0)
{
fprintf (stderr, "Error trap underflow!\n");
exit (1);
}
XSync (xdisplay, False); /* get all errors out of the queue */
--error_trap_depth;
}

76
test/test-launchee-xcb.c Normal file
View File

@ -0,0 +1,76 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include "test-boilerplate.h"
int
main (int argc, char **argv)
{
xcb_connection_t *xconnection;
SnDisplay *display;
SnLauncheeContext *context;
int screen;
xconnection = xcb_connect (NULL, &screen);
if (xconnection == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
display = sn_xcb_display_new (xconnection,
NULL, NULL);
context = sn_launchee_context_new_from_environment (display, screen);
if (context == NULL)
{
fprintf (stderr, "Failed to get launch feedback info from DESKTOP_LAUNCH_ID/DESKTOP_LAUNCH_WINDOW\n");
exit (1);
}
printf ("Launchee started with window ID \"%s\"\n",
sn_launchee_context_get_startup_id (context));
/* simulate startup time */
sleep (4);
printf ("Launchee startup complete\n");
sn_launchee_context_complete (context);
while (TRUE)
{
xcb_generic_event_t *xevent = xcb_wait_for_event(xconnection);
sn_xcb_display_process_event (display, xevent);
free(xevent);
}
return 0;
}

81
test/test-launchee.c Normal file
View File

@ -0,0 +1,81 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include "test-boilerplate.h"
int
main (int argc, char **argv)
{
Display *xdisplay;
SnDisplay *display;
SnLauncheeContext *context;
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
context = sn_launchee_context_new_from_environment (display,
DefaultScreen (xdisplay));
if (context == NULL)
{
fprintf (stderr, "Failed to get launch feedback info from DESKTOP_LAUNCH_ID/DESKTOP_LAUNCH_WINDOW\n");
exit (1);
}
printf ("Launchee started with window ID \"%s\"\n",
sn_launchee_context_get_startup_id (context));
/* simulate startup time */
sleep (4);
printf ("Launchee startup complete\n");
sn_launchee_context_complete (context);
while (TRUE)
{
XEvent xevent;
XNextEvent (xdisplay, &xevent);
sn_display_process_event (display, &xevent);
}
return 0;
}

144
test/test-launcher-xcb.c Normal file
View File

@ -0,0 +1,144 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2002 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <assert.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_aux.h>
#include "test-boilerplate.h"
static pid_t child_pid = 0;
/* This is a poor way to obtain a timestamp normally (one should be available
* to the app from the user clicking on a button or something), but such a
* method is not available for this simple test application.
*/
xcb_timestamp_t
slowly_obtain_timestamp (SnDisplay *display)
{
xcb_window_t xwindow;
xcb_connection_t *xconnection;
xcb_generic_event_t *event;
xcb_screen_t *s;
xconnection = sn_display_get_x_connection (display);
s = xcb_aux_get_screen(xconnection, 0);
{
uint32_t attrs[] = { 1, XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY };
char* name;
xwindow = xcb_generate_id (xconnection);
xcb_create_window (xconnection, XCB_COPY_FROM_PARENT, xwindow,
s->root, -100, -100, 1, 1, 0, XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT, XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK,
attrs);
name = "Fake Window";
xcb_change_property (xconnection, XCB_PROP_MODE_REPLACE,
xwindow, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
strlen (name), name);
}
xcb_flush (xconnection);
event = xcb_wait_for_event (xconnection);
xcb_property_notify_event_t *ev = (xcb_property_notify_event_t *) event;
xcb_timestamp_t timestamp = ev->time;
free (ev);
xcb_destroy_window (xconnection, xwindow);
return timestamp;
}
int
main (int argc, char **argv)
{
xcb_connection_t *xconnection;
SnDisplay *display;
SnLauncherContext *context;
xcb_timestamp_t timestamp;
int screen;
if (argc < 2)
{
fprintf (stderr, "must specify command line to launch\n");
exit (1);
}
xconnection = xcb_connect (NULL, &screen);
if (xconnection == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
display = sn_xcb_display_new (xconnection,
NULL, NULL);
context = sn_launcher_context_new (display, screen);
sn_launcher_context_set_name (context, "Test Launch");
sn_launcher_context_set_description (context, "Launching a test program for libsn");
sn_launcher_context_set_binary_name (context, argv[1]);
timestamp = slowly_obtain_timestamp (display);
sn_launcher_context_initiate (context,
"test-launcher",
argv[1],
timestamp);
switch ((child_pid = fork ()))
{
case -1:
fprintf (stderr, "Fork failed: %s\n", strerror (errno));
break;
case 0:
sn_launcher_context_setup_child_process (context);
execv (argv[1], argv + 1);
fprintf (stderr, "Failed to exec %s: %s\n", argv[1], strerror (errno));
_exit (1);
break;
}
while (TRUE)
{
xcb_generic_event_t *xevent = xcb_wait_for_event (xconnection);
sn_xcb_display_process_event (display, xevent);
free (xevent);
}
sn_launcher_context_unref (context);
return 0;
}

149
test/test-launcher.c Normal file
View File

@ -0,0 +1,149 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <assert.h>
#include <X11/Xatom.h>
#include "test-boilerplate.h"
static pid_t child_pid = 0;
/* This is a poor way to obtain a timestamp normally (one should be available
* to the app from the user clicking on a button or something), but such a
* method is not available for this simple test application.
*/
Time
slowly_obtain_timestamp (SnDisplay *display)
{
Window xwindow;
Display *xdisplay;
XEvent event;
xdisplay = sn_display_get_x_display (display);
{
XSetWindowAttributes attrs;
char* name;
attrs.override_redirect = True;
attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
xwindow =
XCreateWindow (xdisplay,
RootWindow (xdisplay, 0),
-100, -100, 1, 1,
0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
CWOverrideRedirect | CWEventMask,
&attrs);
name = "Fake Window";
XChangeProperty (xdisplay,
xwindow, XA_WM_NAME,
XA_STRING,
8, PropModeReplace, name, strlen (name));
}
XWindowEvent (xdisplay,
xwindow,
PropertyChangeMask,
&event);
XDestroyWindow (xdisplay, xwindow);
return event.xproperty.time;
}
int
main (int argc, char **argv)
{
Display *xdisplay;
SnDisplay *display;
SnLauncherContext *context;
Time timestamp;
if (argc < 2)
{
fprintf (stderr, "must specify command line to launch\n");
exit (1);
}
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
context = sn_launcher_context_new (display, DefaultScreen (xdisplay));
sn_launcher_context_set_name (context, "Test Launch");
sn_launcher_context_set_description (context, "Launching a test program for libsn");
sn_launcher_context_set_binary_name (context, argv[1]);
timestamp = slowly_obtain_timestamp (display);
sn_launcher_context_initiate (context,
"test-launcher",
argv[1],
timestamp);
switch ((child_pid = fork ()))
{
case -1:
fprintf (stderr, "Fork failed: %s\n", strerror (errno));
break;
case 0:
sn_launcher_context_setup_child_process (context);
execv (argv[1], argv + 1);
fprintf (stderr, "Failed to exec %s: %s\n", argv[1], strerror (errno));
_exit (1);
break;
}
while (TRUE)
{
XEvent xevent;
XNextEvent (xdisplay, &xevent);
sn_display_process_event (display, &xevent);
}
sn_launcher_context_unref (context);
return 0;
}

137
test/test-monitor-xcb.c Normal file
View File

@ -0,0 +1,137 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <xcb/xcb_aux.h>
#include "test-boilerplate.h"
static void
monitor_event_func (SnMonitorEvent *event,
void *user_data)
{
SnMonitorContext *context;
SnStartupSequence *sequence;
context = sn_monitor_event_get_context (event);
sequence = sn_monitor_event_get_startup_sequence (event);
switch (sn_monitor_event_get_type (event))
{
case SN_MONITOR_EVENT_INITIATED:
case SN_MONITOR_EVENT_CHANGED:
{
const char *s;
if (sn_monitor_event_get_type (event) == SN_MONITOR_EVENT_INITIATED)
{
printf ("Initiated sequence %s\n",
sn_startup_sequence_get_id (sequence));
}
else
{
printf ("Changed sequence %s\n",
sn_startup_sequence_get_id (sequence));
}
s = sn_startup_sequence_get_id (sequence);
printf (" id %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_name (sequence);
printf (" name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_description (sequence);
printf (" description %s\n", s ? s : "(unset)");
printf (" workspace %d\n",
sn_startup_sequence_get_workspace (sequence));
s = sn_startup_sequence_get_binary_name (sequence);
printf (" binary name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_icon_name (sequence);
printf (" icon name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_wmclass (sequence);
printf (" wm class %s\n", s ? s : "(unset)");
}
break;
case SN_MONITOR_EVENT_COMPLETED:
printf ("Completed sequence %s\n",
sn_startup_sequence_get_id (sequence));
break;
case SN_MONITOR_EVENT_CANCELED:
printf ("Canceled sequence %s\n",
sn_startup_sequence_get_id (sequence));
break;
}
}
int
main (int argc, char **argv)
{
xcb_connection_t *xconnection;
SnDisplay *display;
SnMonitorContext *context;
int screen;
xconnection = xcb_connect (NULL, &screen);
if (xconnection == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
/* We have to select for property events on at least one
* root window (but not all as INITIATE messages go to
* all root windows)
*/
xcb_screen_t *s = xcb_aux_get_screen (xconnection, screen);
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
xcb_change_window_attributes (xconnection, s->root, XCB_CW_EVENT_MASK,
select_input_val);
display = sn_xcb_display_new (xconnection, NULL, NULL);
context = sn_monitor_context_new (display, screen,
monitor_event_func,
NULL, NULL);
while (TRUE)
{
xcb_generic_event_t *xevent = xcb_wait_for_event (xconnection);
sn_xcb_display_process_event (display, xevent);
free (xevent);
}
sn_monitor_context_unref (context);
return 0;
}

138
test/test-monitor.c Normal file
View File

@ -0,0 +1,138 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include "test-boilerplate.h"
static void
monitor_event_func (SnMonitorEvent *event,
void *user_data)
{
SnMonitorContext *context;
SnStartupSequence *sequence;
context = sn_monitor_event_get_context (event);
sequence = sn_monitor_event_get_startup_sequence (event);
switch (sn_monitor_event_get_type (event))
{
case SN_MONITOR_EVENT_INITIATED:
case SN_MONITOR_EVENT_CHANGED:
{
const char *s;
if (sn_monitor_event_get_type (event) == SN_MONITOR_EVENT_INITIATED)
{
printf ("Initiated sequence %s\n",
sn_startup_sequence_get_id (sequence));
}
else
{
printf ("Changed sequence %s\n",
sn_startup_sequence_get_id (sequence));
}
s = sn_startup_sequence_get_id (sequence);
printf (" id %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_name (sequence);
printf (" name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_description (sequence);
printf (" description %s\n", s ? s : "(unset)");
printf (" workspace %d\n",
sn_startup_sequence_get_workspace (sequence));
s = sn_startup_sequence_get_binary_name (sequence);
printf (" binary name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_icon_name (sequence);
printf (" icon name %s\n", s ? s : "(unset)");
s = sn_startup_sequence_get_wmclass (sequence);
printf (" wm class %s\n", s ? s : "(unset)");
}
break;
case SN_MONITOR_EVENT_COMPLETED:
printf ("Completed sequence %s\n",
sn_startup_sequence_get_id (sequence));
break;
case SN_MONITOR_EVENT_CANCELED:
printf ("Canceled sequence %s\n",
sn_startup_sequence_get_id (sequence));
break;
}
}
int
main (int argc, char **argv)
{
Display *xdisplay;
SnDisplay *display;
SnMonitorContext *context;
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
/* We have to select for property events on at least one
* root window (but not all as INITIATE messages go to
* all root windows)
*/
XSelectInput (xdisplay, DefaultRootWindow (xdisplay),
PropertyChangeMask);
display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
context = sn_monitor_context_new (display, DefaultScreen (xdisplay),
monitor_event_func,
NULL, NULL);
while (TRUE)
{
XEvent xevent;
XNextEvent (xdisplay, &xevent);
sn_display_process_event (display, &xevent);
}
sn_monitor_context_unref (context);
return 0;
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <libsn/sn-xmessages.h>
#include "test-boilerplate.h"
int
main (int argc, char **argv)
{
xcb_connection_t *xconnection;
SnDisplay *display;
if (argc != 4)
{
fprintf (stderr, "Must specify message type, message begin type, and message content as first, second, and third args\n");
return 1;
}
int screen;
xconnection = xcb_connect (NULL, &screen);
if (xconnection == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
display = sn_xcb_display_new (xconnection, NULL, NULL);
sn_internal_broadcast_xmessage (display, screen,
argv[1],
argv[2],
argv[3]);
return 0;
}

65
test/test-send-xmessage.c Normal file
View File

@ -0,0 +1,65 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <libsn/sn-xmessages.h>
#include "test-boilerplate.h"
int
main (int argc, char **argv)
{
Display *xdisplay;
SnDisplay *display;
if (argc != 4)
{
fprintf (stderr, "Must specify message type, message begin type, and message content as first, second, and third args\n");
return 1;
}
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
sn_internal_broadcast_xmessage (display, DefaultScreen (xdisplay),
argv[1],
argv[2],
argv[3]);
return 0;
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2009 Julien Danjou <julien@danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <libsn/sn-xmessages.h>
#include <libsn/sn-internals.h>
#include <xcb/xcb_aux.h>
#include "test-boilerplate.h"
static void
message_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data)
{
char *prefix;
char **names;
char **values;
int i;
#if 0
printf ("raw %s: %s\n",
message_type, message);
#endif
prefix = NULL;
names = NULL;
values = NULL;
if (sn_internal_unserialize_message (message,
&prefix, &names, &values))
{
printf (" %s:\n", prefix);
i = 0;
while (names && names[i])
{
printf (" '%s' = '%s'\n", names[i], values[i]);
++i;
}
sn_internal_strfreev (names);
sn_internal_strfreev (values);
}
}
int
main (int argc, char **argv)
{
xcb_connection_t *xconnection;
SnDisplay *display;
if (argc != 3)
{
fprintf (stderr, "arguments must be type and begin type of events to watch\n");
return 1;
}
int screen;
xconnection = xcb_connect (NULL, &screen);
if (xconnection == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
/* We have to select for property events on one root window
*/
xcb_screen_t *s = xcb_aux_get_screen (xconnection, screen);
const uint32_t select_input_val[] = { XCB_EVENT_MASK_PROPERTY_CHANGE };
xcb_change_window_attributes (xconnection, s->root, XCB_CW_EVENT_MASK,
select_input_val);
display = sn_xcb_display_new (xconnection, NULL, NULL);
sn_internal_add_xmessage_func (display, screen,
argv[1], argv[2],
message_func,
NULL, NULL);
while (TRUE)
{
xcb_generic_event_t *xevent = xcb_wait_for_event (xconnection);
sn_xcb_display_process_event (display, xevent);
free (xevent);
}
return 0;
}

118
test/test-watch-xmessages.c Normal file
View File

@ -0,0 +1,118 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <libsn/sn.h>
#include <libsn/sn-xmessages.h>
#include <libsn/sn-internals.h>
#include "test-boilerplate.h"
static void
message_func (SnDisplay *display,
const char *message_type,
const char *message,
void *user_data)
{
char *prefix;
char **names;
char **values;
int i;
#if 0
printf ("raw %s: %s\n",
message_type, message);
#endif
prefix = NULL;
names = NULL;
values = NULL;
if (sn_internal_unserialize_message (message,
&prefix, &names, &values))
{
printf (" %s:\n", prefix);
i = 0;
while (names && names[i])
{
printf (" '%s' = '%s'\n", names[i], values[i]);
++i;
}
sn_internal_strfreev (names);
sn_internal_strfreev (values);
}
}
int
main (int argc, char **argv)
{
Display *xdisplay;
SnDisplay *display;
if (argc != 3)
{
fprintf (stderr, "arguments must be type and begin type of events to watch\n");
return 1;
}
xdisplay = XOpenDisplay (NULL);
if (xdisplay == NULL)
{
fprintf (stderr, "Could not open display\n");
return 1;
}
if (getenv ("LIBSN_SYNC") != NULL)
XSynchronize (xdisplay, True);
XSetErrorHandler (x_error_handler);
/* We have to select for property events on one root window
*/
XSelectInput (xdisplay, DefaultRootWindow (xdisplay),
PropertyChangeMask);
display = sn_display_new (xdisplay,
error_trap_push,
error_trap_pop);
sn_internal_add_xmessage_func (display, DefaultScreen (xdisplay),
argv[1], argv[2],
message_func,
NULL, NULL);
while (TRUE)
{
XEvent xevent;
XNextEvent (xdisplay, &xevent);
sn_display_process_event (display, &xevent);
}
return 0;
}