summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS0
-rw-r--r--COPYING340
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am3
-rw-r--r--NEWS0
-rw-r--r--README0
-rw-r--r--acconfig.h11
-rwxr-xr-xautogen.sh135
-rw-r--r--configure.in73
-rw-r--r--po/POTFILES.in0
-rw-r--r--src/Makefile.am34
-rw-r--r--src/api.h2
-rw-r--r--src/display.c8
-rw-r--r--src/display.h4
-rw-r--r--src/errors.c2
-rw-r--r--src/eventqueue.c2
-rw-r--r--src/eventqueue.h2
-rw-r--r--src/frame.c144
-rw-r--r--src/frame.h21
-rw-r--r--src/screen.c2
-rw-r--r--src/theme.c58
-rw-r--r--src/theme.h2
-rw-r--r--src/uislave.c29
-rw-r--r--src/uislave.h39
-rw-r--r--src/uislave/Makefile.am9
-rw-r--r--src/uislave/main.c27
-rw-r--r--src/window.c405
-rw-r--r--src/window.h21
-rw-r--r--stamp.h.in0
29 files changed, 1314 insertions, 59 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/AUTHORS
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 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.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, 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 software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, 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 redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+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 give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) 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; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, 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 executable. 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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+ 5. 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 Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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.
+
+ 7. 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 Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the 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 Program
+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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), 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 Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 of the License, 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, 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.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..cd6fc53
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+
+SUBDIRS=src intl po
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 0000000..7e0cc16
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,11 @@
+#undef PACKAGE
+#undef VERSION
+#undef HAVE_CATGETS
+#undef HAVE_GETTEXT
+#undef HAVE_LC_MESSAGES
+#undef HAVE_STPCPY
+#undef ENABLE_NLS
+#undef HAVE_PTHREAD_H
+#undef GETTEXT_PACKAGE
+#undef HAVE_SHAPE_EXT
+#undef HAVE_XFT
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..2ec8ceb
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,135 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+PROJECT=metacity
+TEST_TYPE=-f
+FILE=src/display.c
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile $PROJECT."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have automake installed to compile $PROJECT."
+ echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+(grep "^AM_PROG_LIBTOOL" configure.in >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed to compile $PROJECT."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+grep "^AM_GNU_GETTEXT" configure.in >/dev/null && {
+ grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
+ (gettext --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`gettext' installed to compile $PROJECT."
+ echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+ echo "You must run this script in the top-level $PROJECT directory"
+ exit 1
+}
+
+if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+case $CC in
+*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
+esac
+
+for coin in `find . -name configure.in -print`
+do
+ dr=`dirname $coin`
+ if test -f $dr/NO-AUTO-GEN; then
+ echo skipping $dr -- flagged as no auto-gen
+ else
+ echo processing $dr
+ macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
+ ( cd $dr
+ aclocalinclude="$ACLOCAL_FLAGS"
+ for k in $macrodirs; do
+ if test -d $k; then
+ aclocalinclude="$aclocalinclude -I $k"
+ ##else
+ ## echo "**Warning**: No such directory \`$k'. Ignored."
+ fi
+ done
+ if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
+ if grep "sed.*POTFILES" configure.in >/dev/null; then
+ : do nothing -- we still have an old unmodified configure.in
+ else
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running gettextize... Ignore non-fatal messages."
+ echo "no" | gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ fi
+ if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running gettextize... Ignore non-fatal messages."
+ echo "no" | gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ aclocal $aclocalinclude
+ if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ fi
+ echo "Running automake --gnu $am_opt ..."
+ automake --add-missing --gnu $am_opt
+ echo "Running autoconf ..."
+ autoconf
+ )
+ fi
+done
+
+conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
+
+cd "$ORIGDIR"
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile $PROJECT || exit 1
+else
+ echo Skipping configure process.
+fi
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..33e4dc9
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,73 @@
+AC_INIT(src/display.c)
+
+AM_CONFIG_HEADER(config.h)
+
+AM_INIT_AUTOMAKE(metacity, 2.3)
+
+GETTEXT_PACKAGE=metacity
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_ISC_POSIX
+AC_HEADER_STDC
+AC_ARG_PROGRAM
+AM_PROG_LIBTOOL
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wall" ;;
+ esac
+
+ if test "x$enable_ansi" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -ansi" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -pedantic" ;;
+ esac
+ fi
+fi
+changequote([,])dnl
+
+ALL_LINGUAS=""
+AM_GNU_GETTEXT
+
+if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+fi
+
+## see if we have Pango built with xft support
+if $PKG_CONFIG --exists pangoxft ; then
+ PANGO_PACKAGES="pangox pangoxft"
+ have_xft=true
+ AC_DEFINE(HAVE_XFT)
+else
+ PANGO_PACKAGES="pangox"
+ have_xft=false
+fi
+AM_CONDITIONAL(HAVE_XFT, $have_xft)
+
+## here we get the flags we'll actually use
+PKG_CHECK_MODULES(UISLAVE, gtk+-2.0 >= 1.3.5)
+PKG_CHECK_MODULES(METACITY, $PANGO_PACKAGES)
+
+# Check for shaped window extension
+AC_CHECK_LIB(Xext, XShapeCombineMask, AC_DEFINE(HAVE_SHAPE_EXT),,$METACITY_LIBS)
+
+AC_OUTPUT([
+Makefile
+intl/Makefile
+po/Makefile.in
+src/Makefile
+src/uislave/Makefile
+])
+
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/po/POTFILES.in
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..186c476
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,34 @@
+
+SUBDIRS=uislave
+
+INCLUDES=@METACITY_CFLAGS@
+
+metacity_SOURCES= \
+ api.c \
+ api.h \
+ colors.c \
+ colors.h \
+ display.c \
+ display.h \
+ errors.c \
+ errors.h \
+ eventqueue.c \
+ eventqueue.h \
+ frame.c \
+ frame.h \
+ main.c \
+ main.h \
+ screen.c \
+ screen.h \
+ theme.c \
+ theme.h \
+ uislave.c \
+ uislave.h \
+ util.c \
+ util.h \
+ window.c \
+ window.h
+
+bin_PROGRAMS=metacity
+
+metacity_LDADD= @METACITY_LIBS@
diff --git a/src/api.h b/src/api.h
index 84f375e..752f4bd 100644
--- a/src/api.h
+++ b/src/api.h
@@ -25,7 +25,7 @@
/* don't add any internal headers here; api.h is an installed/public
* header. Only theme.h is also installed.
*/
-#include <Xlib.h>
+#include <X11/Xlib.h>
#include <pango/pangox.h>
PangoContext* meta_get_pango_context (Screen *xscreen,
diff --git a/src/display.c b/src/display.c
index 505619a..a32c537 100644
--- a/src/display.c
+++ b/src/display.c
@@ -63,7 +63,9 @@ meta_display_open (const char *name)
GSList *screens;
GSList *tmp;
int i;
-
+ char *atom_names[] = { "_NET_WM_NAME" };
+ Atom atoms[G_N_ELEMENTS(atom_names)];
+
meta_verbose ("Opening display '%s'\n", XDisplayName (name));
xdisplay = XOpenDisplay (name);
@@ -122,6 +124,10 @@ meta_display_open (const char *name)
display->server_grab_count = 0;
+ XInternAtoms (display->xdisplay, atom_names, G_N_ELEMENTS (atom_names),
+ False, atoms);
+ display->atom_net_wm_name = atoms[0];
+
/* Now manage all existing windows */
tmp = display->screens;
while (tmp != NULL)
diff --git a/src/display.h b/src/display.h
index 4abf41b..755ae41 100644
--- a/src/display.h
+++ b/src/display.h
@@ -23,7 +23,7 @@
#define META_DISPLAY_H
#include <glib.h>
-#include <Xlib.h>
+#include <X11/Xlib.h>
#include <pango/pangox.h>
#include "eventqueue.h"
@@ -37,6 +37,8 @@ struct _MetaDisplay
char *name;
Display *xdisplay;
+ Atom atom_net_wm_name;
+
/*< private-ish >*/
MetaEventQueue *events;
GSList *screens;
diff --git a/src/errors.c b/src/errors.c
index 9d241a2..daae3a5 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -73,7 +73,7 @@ meta_error_trap_pop (MetaDisplay *display)
display->error_traps = next;
g_free (et);
-
+
if (result != Success)
{
gchar buf[64];
diff --git a/src/eventqueue.c b/src/eventqueue.c
index 1874b65..11c1dc9 100644
--- a/src/eventqueue.c
+++ b/src/eventqueue.c
@@ -20,7 +20,7 @@
* 02111-1307, USA. */
#include "eventqueue.h"
-#include <Xlib.h>
+#include <X11/Xlib.h>
static gboolean eq_prepare (GSource *source,
gint *timeout);
diff --git a/src/eventqueue.h b/src/eventqueue.h
index 603314b..10f0fbc 100644
--- a/src/eventqueue.h
+++ b/src/eventqueue.h
@@ -23,7 +23,7 @@
#define META_EVENT_QUEUE_H
#include <glib.h>
-#include <Xlib.h>
+#include <X11/Xlib.h>
typedef struct _MetaEventQueue MetaEventQueue;
diff --git a/src/frame.c b/src/frame.c
index df256f7..bd22c41 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -82,7 +82,7 @@ meta_window_ensure_frame (MetaWindow *window)
background_pixel = geom.background_pixel;
- switch (window->win_gravity)
+ switch (window->size_hints.win_gravity)
{
case NorthWestGravity:
frame->rect.x = window->rect.x;
@@ -127,18 +127,20 @@ meta_window_ensure_frame (MetaWindow *window)
break;
}
- meta_verbose ("Creating frame %d,%d %dx%d around window 0x%lx %d,%d %dx%d with child position inside frame %d,%d\n",
+ meta_verbose ("Creating frame %d,%d %dx%d around window 0x%lx %d,%d %dx%d with child position inside frame %d,%d and gravity %d\n",
frame->rect.x, frame->rect.y,
frame->rect.width, frame->rect.height,
window->xwindow,
window->rect.x, window->rect.y,
window->rect.width, window->rect.height,
- child_x, child_y);
+ child_x, child_y,
+ window->size_hints.win_gravity);
attrs.background_pixel = background_pixel;
attrs.event_mask =
StructureNotifyMask | ExposureMask |
- ButtonPressMask | ButtonReleaseMask;
+ ButtonPressMask | ButtonReleaseMask |
+ PointerMotionMask | PointerMotionHintMask;
frame->xwindow = XCreateWindow (window->display->xdisplay,
window->screen->xroot,
@@ -152,6 +154,13 @@ meta_window_ensure_frame (MetaWindow *window)
window->xvisual,
CWBackPixel | CWEventMask,
&attrs);
+
+ meta_verbose ("Frame is 0x%lx\n", frame->xwindow);
+
+ frame->action = META_FRAME_ACTION_NONE;
+ frame->last_x = 0;
+ frame->last_y = 0;
+ frame->start_button = 0;
meta_display_register_x_window (window->display, &frame->xwindow, window);
@@ -172,12 +181,13 @@ meta_window_ensure_frame (MetaWindow *window)
child_y);
meta_error_trap_pop (window->display);
- /* Show windows */
- XMapWindow (window->display->xdisplay, frame->xwindow);
- XMapWindow (window->display->xdisplay, window->xwindow);
-
/* stick frame to the window */
- window->frame = frame;
+ window->frame = frame;
+
+ if (window->iconic)
+ meta_window_hide (window);
+ else
+ meta_window_show (window);
/* Ungrab server */
meta_display_ungrab (window->display);
@@ -223,23 +233,60 @@ meta_window_destroy_frame (MetaWindow *window)
g_free (frame);
}
-
void
-meta_frame_show (MetaFrame *frame)
+meta_frame_move (MetaFrame *frame,
+ int root_x,
+ int root_y)
{
- XMapWindow (frame->window->display->xdisplay, frame->xwindow);
+ frame->rect.x = root_x;
+ frame->rect.y = root_y;
+
+ XMoveWindow (frame->window->display->xdisplay,
+ frame->xwindow,
+ root_x, root_y);
}
-void
-meta_frame_hide (MetaFrame *frame)
+static void
+frame_query_root_pointer (MetaFrame *frame,
+ int *x, int *y)
+{
+ Window root_return, child_return;
+ int root_x_return, root_y_return;
+ int win_x_return, win_y_return;
+ unsigned int mask_return;
+
+ XQueryPointer (frame->window->display->xdisplay,
+ frame->xwindow,
+ &root_return,
+ &child_return,
+ &root_x_return,
+ &root_y_return,
+ &win_x_return,
+ &win_y_return,
+ &mask_return);
+
+ if (x)
+ *x = root_x_return;
+ if (y)
+ *y = root_y_return;
+}
+
+static MetaFrameControl
+frame_get_control (MetaFrame *frame,
+ int x, int y)
{
- XUnmapWindow (frame->window->display->xdisplay, frame->xwindow);
+ MetaFrameInfo info;
+ meta_frame_init_info (frame, &info);
+
+ return frame->window->screen->engine->get_control (&info,
+ x, y,
+ frame->theme_data);
}
gboolean
meta_frame_event (MetaFrame *frame,
XEvent *event)
-{
+{
switch (event->type)
{
case KeyPress:
@@ -247,10 +294,68 @@ meta_frame_event (MetaFrame *frame,
case KeyRelease:
break;
case ButtonPress:
+ if (frame->action == META_FRAME_ACTION_NONE)
+ {
+ MetaFrameControl control;
+ control = frame_get_control (frame,
+ event->xbutton.x,
+ event->xbutton.y);
+
+ if (((control == META_FRAME_CONTROL_TITLE ||
+ control == META_FRAME_CONTROL_NONE) &&
+ event->xbutton.button == 1) ||
+ event->xbutton.button == 2)
+ {
+ meta_verbose ("Begin move on %s\n",
+ frame->window->desc);
+ frame->action = META_FRAME_ACTION_MOVING;
+ frame->last_x = event->xbutton.x_root;
+ frame->last_y = event->xbutton.y_root;
+ frame->start_button = event->xbutton.button;
+ }
+ else if (control == META_FRAME_CONTROL_DELETE &&
+ event->xbutton.button == 1)
+ {
+ /* FIXME delete event */
+ meta_verbose ("Close control clicked on %s\n",
+ frame->window->desc);
+ }
+ else if (control == META_FRAME_CONTROL_RESIZE_SE &&
+ event->xbutton.button == 1)
+ {
+ /* FIXME begin a resize */
+ meta_verbose ("Resize control clicked on %s\n",
+ frame->window->desc);
+ }
+ }
break;
case ButtonRelease:
+ if (event->xbutton.button == frame->start_button)
+ {
+ frame->action = META_FRAME_ACTION_NONE;
+ }
break;
case MotionNotify:
+ switch (frame->action)
+ {
+ case META_FRAME_ACTION_MOVING:
+ {
+ int x, y;
+ int new_x, new_y;
+ frame_query_root_pointer (frame, &x, &y);
+
+ new_x = frame->rect.x + (x - frame->last_x);
+ new_y = frame->rect.y + (y - frame->last_y);
+ frame->last_x = x;
+ frame->last_y = y;
+
+ meta_frame_move (frame, new_x, new_y);
+ }
+ break;
+
+ default:
+ break;
+ }
break;
case EnterNotify:
break;
@@ -290,19 +395,16 @@ meta_frame_event (MetaFrame *frame,
return TRUE;
break;
case UnmapNotify:
+ frame->action = META_FRAME_ACTION_NONE;
break;
case MapNotify:
+ frame->action = META_FRAME_ACTION_NONE;
break;
case MapRequest:
break;
case ReparentNotify:
break;
case ConfigureNotify:
- frame->rect.x = event->xconfigure.x;
- frame->rect.y = event->xconfigure.y;
- frame->rect.width = event->xconfigure.width;
- frame->rect.height = event->xconfigure.height;
- return TRUE;
break;
case ConfigureRequest:
break;
diff --git a/src/frame.h b/src/frame.h
index e767e28..e63f6f8 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -24,6 +24,13 @@
#include "window.h"
+typedef enum
+{
+ META_FRAME_ACTION_NONE,
+ META_FRAME_ACTION_MOVING,
+ META_FRAME_ACTION_RESIZING
+} MetaFrameAction;
+
struct _MetaFrame
{
/* window we frame */
@@ -32,19 +39,27 @@ struct _MetaFrame
/* reparent window */
Window xwindow;
+ /* This is trusted info from where we put the
+ * frame, not the result of ConfigureNotify
+ */
MetaRectangle rect;
gpointer theme_data;
+
+ MetaFrameAction action;
+ /* reference point for drags */
+ int last_x, last_y;
+ int start_button;
};
void meta_window_ensure_frame (MetaWindow *window);
void meta_window_destroy_frame (MetaWindow *window);
-void meta_frame_show (MetaFrame *frame);
-void meta_frame_hide (MetaFrame *frame);
+void meta_frame_move (MetaFrame *frame,
+ int root_x,
+ int root_y);
gboolean meta_frame_event (MetaFrame *frame,
XEvent *event);
-
#endif
diff --git a/src/screen.c b/src/screen.c
index 3196604..afeb30f 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -25,7 +25,7 @@
#include "window.h"
#include "colors.h"
-#include <cursorfont.h>
+#include <X11/cursorfont.h>
#include <locale.h>
#include <string.h>
diff --git a/src/theme.c b/src/theme.c
index e14b398..568c5c0 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -28,6 +28,8 @@ struct _DefaultFrameData
{
PangoLayout *layout;
GC text_gc;
+ GC fg_gc;
+ int title_height;
};
static gpointer
@@ -47,10 +49,19 @@ default_acquire_frame (MetaFrameInfo *info)
color.red = color.green = color.blue = 0xffff;
vals.foreground = meta_get_x_pixel (info->screen, &color);
+ /* FIXME memory-inefficient, could use the same one for all frames
+ * w/ the same root window
+ */
d->text_gc = XCreateGC (info->display,
RootWindowOfScreen (info->screen),
GCForeground,
&vals);
+ d->fg_gc = XCreateGC (info->display,
+ RootWindowOfScreen (info->screen),
+ GCForeground,
+ &vals);
+
+ d->title_height = 0;
return d;
}
@@ -67,14 +78,15 @@ default_release_frame (MetaFrameInfo *info,
g_object_unref (G_OBJECT (d->layout));
XFreeGC (info->display, d->text_gc);
+ XFreeGC (info->display, d->fg_gc);
g_free (d);
}
#define VERTICAL_TEXT_PAD 3
-#define LEFT_WIDTH 2
-#define RIGHT_WIDTH 2
-#define BOTTOM_HEIGHT 2
+#define LEFT_WIDTH 15
+#define RIGHT_WIDTH 15
+#define BOTTOM_HEIGHT 20
void
default_fill_frame_geometry (MetaFrameInfo *info,
MetaFrameGeometry *geom,
@@ -93,7 +105,8 @@ default_fill_frame_geometry (MetaFrameInfo *info,
pango_layout_get_pixel_extents (d->layout, NULL, &rect);
- geom->top_height = rect.height + VERTICAL_TEXT_PAD * 2;
+ d->title_height = rect.height + VERTICAL_TEXT_PAD * 2;
+ geom->top_height = d->title_height;
geom->left_width = LEFT_WIDTH;
geom->right_width = RIGHT_WIDTH;
@@ -111,6 +124,7 @@ default_expose_frame (MetaFrameInfo *info,
gpointer frame_data)
{
DefaultFrameData *d;
+ int close_size;
d = frame_data;
@@ -120,15 +134,49 @@ default_expose_frame (MetaFrameInfo *info,
d->layout,
LEFT_WIDTH,
VERTICAL_TEXT_PAD);
+
+ close_size = d->title_height;
+
+ XDrawLine (info->display,
+ info->frame,
+ d->fg_gc,
+ info->width - RIGHT_WIDTH - close_size,
+ VERTICAL_TEXT_PAD,
+ info->width - RIGHT_WIDTH,
+ d->title_height - VERTICAL_TEXT_PAD);
+
+ XDrawLine (info->display,
+ info->frame,
+ d->fg_gc,
+ info->width - RIGHT_WIDTH,
+ VERTICAL_TEXT_PAD,
+ info->width - RIGHT_WIDTH - close_size,
+ d->title_height - VERTICAL_TEXT_PAD);
}
+#define RESIZE_EXTENDS 10
MetaFrameControl
default_get_control (MetaFrameInfo *info,
int x, int y,
gpointer frame_data)
{
+ DefaultFrameData *d;
+ int close_size;
+
+ d = frame_data;
-
+ close_size = d->title_height;
+ if (y < d->title_height &&
+ x > info->width - RIGHT_WIDTH - close_size)
+ return META_FRAME_CONTROL_DELETE;
+
+ if (y < d->title_height)
+ return META_FRAME_CONTROL_TITLE;
+
+ if (y > (info->height - BOTTOM_HEIGHT - RESIZE_EXTENDS) &&
+ x > (info->width - RIGHT_WIDTH - RESIZE_EXTENDS))
+ return META_FRAME_CONTROL_RESIZE_SE;
+
return META_FRAME_CONTROL_NONE;
}
diff --git a/src/theme.h b/src/theme.h
index 68e69e9..84909d9 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -25,7 +25,7 @@
/* don't add any internal headers here; theme.h is an installed/public
* header.
*/
-#include <Xlib.h>
+#include <X11/Xlib.h>
#include <glib.h>
typedef struct _MetaFrameInfo MetaFrameInfo;
diff --git a/src/uislave.c b/src/uislave.c
new file mode 100644
index 0000000..11eb6f2
--- /dev/null
+++ b/src/uislave.c
@@ -0,0 +1,29 @@
+/* Metacity UI Slave */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * 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 of the
+ * License, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "uislave.h"
+
+MetaUISlave*
+meta_ui_slave_new (const char *display_name)
+{
+
+
+}
diff --git a/src/uislave.h b/src/uislave.h
new file mode 100644
index 0000000..db2f1d4
--- /dev/null
+++ b/src/uislave.h
@@ -0,0 +1,39 @@
+/* Metacity UI Slave */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * 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 of the
+ * License, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef META_UI_SLAVE_H
+#define META_UI_SLAVE_H
+
+#include "util.h"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef struct _MetaUISlave MetaUISlave;
+
+struct _MetaUISlave
+{
+ char *display_name;
+};
+
+MetaUISlave* meta_ui_slave_new (const char *display_name);
+
+
+#endif
diff --git a/src/uislave/Makefile.am b/src/uislave/Makefile.am
new file mode 100644
index 0000000..920fd82
--- /dev/null
+++ b/src/uislave/Makefile.am
@@ -0,0 +1,9 @@
+
+INCLUDES=@UISLAVE_CFLAGS@
+
+metacity_uislave_SOURCES = \
+ main.c
+
+libexec_PROGRAMS=metacity-uislave
+
+metacity_uislave_LDADD = @UISLAVE_LIBS@ \ No newline at end of file
diff --git a/src/uislave/main.c b/src/uislave/main.c
new file mode 100644
index 0000000..a5260cd
--- /dev/null
+++ b/src/uislave/main.c
@@ -0,0 +1,27 @@
+/* Metacity UI slave main() */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * 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 of the
+ * License, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+int
+main (int argc, char **argv)
+{
+
+ return 0;
+}
diff --git a/src/window.c b/src/window.c
index 1ceca5e..83153c2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -23,6 +23,23 @@
#include "util.h"
#include "frame.h"
#include "errors.h"
+#include <X11/Xatom.h>
+
+static void constrain_size (MetaWindow *window,
+ int width,
+ int height,
+ int *new_width,
+ int *new_height);
+static int update_size_hints (MetaWindow *window);
+static int update_title (MetaWindow *window);
+static int update_protocols (MetaWindow *window);
+static gboolean process_configure_request (MetaWindow *window,
+ XConfigureRequestEvent *event);
+static gboolean process_property_notify (MetaWindow *window,
+ XPropertyEvent *event);
+
+
+
MetaWindow*
meta_window_new (MetaDisplay *display, Window xwindow)
@@ -30,12 +47,12 @@ meta_window_new (MetaDisplay *display, Window xwindow)
MetaWindow *window;
XWindowAttributes attrs;
GSList *tmp;
-
+
meta_verbose ("Attempting to manage 0x%lx\n", xwindow);
/* round trip */
meta_error_trap_push (display);
-
+
if (XGetWindowAttributes (display->xdisplay,
xwindow, &attrs) == Success &&
attrs.override_redirect)
@@ -88,15 +105,20 @@ meta_window_new (MetaDisplay *display, Window xwindow)
window->rect.y = attrs.y;
window->rect.width = attrs.width;
window->rect.height = attrs.height;
- window->border_width = attrs.border_width;
- window->win_gravity = attrs.win_gravity;
window->depth = attrs.depth;
window->xvisual = attrs.visual;
- window->title = g_strdup ("Foo foo foo foo");
+ window->title = NULL;
+ window->iconic = FALSE;
+
+ window->desc = g_strdup_printf ("0x%lx", window->xwindow);
meta_display_register_x_window (display, &window->xwindow, window);
+ update_size_hints (window);
+ update_title (window);
+ update_protocols (window);
+
window->frame = NULL;
meta_window_ensure_frame (window);
@@ -117,6 +139,26 @@ meta_window_free (MetaWindow *window)
g_free (window);
}
+void
+meta_window_show (MetaWindow *window)
+{
+ if (window->frame)
+ XMapWindow (window->display->xdisplay, window->frame->xwindow);
+ XMapWindow (window->display->xdisplay, window->xwindow);
+
+ window->iconic = FALSE;
+}
+
+void
+meta_window_hide (MetaWindow *window)
+{
+ if (window->frame)
+ XUnmapWindow (window->display->xdisplay, window->frame->xwindow);
+ XUnmapWindow (window->display->xdisplay, window->xwindow);
+
+ window->iconic = TRUE;
+}
+
gboolean
meta_window_event (MetaWindow *window,
XEvent *event)
@@ -165,12 +207,11 @@ meta_window_event (MetaWindow *window,
return TRUE;
break;
case UnmapNotify:
- if (window->frame)
- meta_frame_hide (window->frame);
+ /* Window withdrawn */
+ meta_window_free (window);
+ return TRUE;
break;
case MapNotify:
- if (window->frame)
- meta_frame_show (window->frame);
break;
case MapRequest:
break;
@@ -179,21 +220,15 @@ meta_window_event (MetaWindow *window,
case ConfigureNotify:
if (event->xconfigure.override_redirect)
{
- /* Unmanage it */
+ /* Unmanage it, override_redirect was toggled on?
+ * Can this happen?
+ */
meta_window_free (window);
return TRUE;
}
- else
- {
- window->rect.x = event->xconfigure.x;
- window->rect.y = event->xconfigure.y;
- window->rect.width = event->xconfigure.width;
- window->rect.height = event->xconfigure.height;
- window->border_width = event->xconfigure.border_width;
- return TRUE;
- }
break;
case ConfigureRequest:
+ return process_configure_request (window, &event->xconfigurerequest);
break;
case GravityNotify:
break;
@@ -204,6 +239,7 @@ meta_window_event (MetaWindow *window,
case CirculateRequest:
break;
case PropertyNotify:
+ return process_property_notify (window, &event->xproperty);
break;
case SelectionClear:
break;
@@ -224,3 +260,334 @@ meta_window_event (MetaWindow *window,
/* Didn't use this event */
return FALSE;
}
+
+static gboolean
+process_property_notify (MetaWindow *window,
+ XPropertyEvent *event)
+{
+ if (event->atom == XA_WM_NAME ||
+ event->atom == window->display->atom_net_wm_name)
+ {
+ update_title (window);
+ }
+ else if (event->atom == XA_WM_NORMAL_HINTS)
+ {
+ update_size_hints (window);
+ }
+ else if (event->atom == XA_WM_PROTOCOLS)
+ {
+ update_protocols (window);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+process_configure_request (MetaWindow *window,
+ XConfigureRequestEvent *event)
+{
+ /* ICCCM 4.1.5 */
+
+ /* Note that x, y is the corner of the window border,
+ * and width, height is the size of the window inside
+ * its border, but that we always deny border requests
+ * because we don't believe in clients who use lame-ass
+ * X features like that.
+ */
+ window->border_width = event->border_width;
+ window->size_hints.x = event->x;
+ window->size_hints.y = event->y;
+ window->size_hints.width = event->width;
+ window->size_hints.height = event->height;
+
+ /* FIXME */
+
+ return TRUE;
+}
+
+static int
+update_size_hints (MetaWindow *window)
+{
+ int x, y, w, h;
+
+ /* Save the last ConfigureRequest, which we put here.
+ * Values here set in the hints are supposed to
+ * be ignored.
+ */
+ x = window->size_hints.x;
+ y = window->size_hints.y;
+ w = window->size_hints.width;
+ h = window->size_hints.height;
+
+ window->size_hints.flags = 0;
+
+ meta_error_trap_push (window->display);
+ XGetNormalHints (window->display->xdisplay,
+ window->xwindow,
+ &window->size_hints);
+
+ /* Put it back. */
+ window->size_hints.x = x;
+ window->size_hints.y = y;
+ window->size_hints.width = w;
+ window->size_hints.height = h;
+
+ if (window->size_hints.flags & PBaseSize)
+ ;
+ else if (window->size_hints.flags & PMinSize)
+ {
+ window->size_hints.base_width = window->size_hints.min_width;
+ window->size_hints.base_height = window->size_hints.min_height;
+ }
+ else
+ {
+ window->size_hints.base_width = 0;
+ window->size_hints.base_height = 0;
+ }
+ window->size_hints.flags |= PBaseSize;
+
+ if (window->size_hints.flags & PMinSize)
+ ;
+ else if (window->size_hints.flags & PBaseSize)
+ {
+ window->size_hints.min_width = window->size_hints.base_width;
+ window->size_hints.min_height = window->size_hints.base_height;
+ }
+ else
+ {
+ window->size_hints.min_width = 0;
+ window->size_hints.min_height = 0;
+ }
+ window->size_hints.flags |= PMinSize;
+
+ if (window->size_hints.flags & PMaxSize)
+ ;
+ else
+ {
+ window->size_hints.max_width = G_MAXINT;
+ window->size_hints.max_height = G_MAXINT;
+ window->size_hints.flags |= PMaxSize;
+ }
+
+ if (window->size_hints.flags & PResizeInc)
+ ;
+ else
+ {
+ window->size_hints.width_inc = 1;
+ window->size_hints.height_inc = 1;
+ window->size_hints.flags |= PResizeInc;
+ }
+
+ if (window->size_hints.flags & PAspect)
+ {
+ /* don't divide by 0 */
+ if (window->size_hints.min_aspect.y < 1)
+ window->size_hints.min_aspect.y = 1;
+ if (window->size_hints.max_aspect.y < 1)
+ window->size_hints.max_aspect.y = 1;
+ }
+ else
+ {
+ window->size_hints.min_aspect.x = 1;
+ window->size_hints.min_aspect.y = G_MAXINT;
+ window->size_hints.max_aspect.x = G_MAXINT;
+ window->size_hints.max_aspect.y = 1;
+ window->size_hints.flags |= PAspect;
+ }
+
+ if (window->size_hints.flags & PWinGravity)
+ ;
+ else
+ {
+ window->size_hints.win_gravity = NorthWestGravity;
+ window->size_hints.flags |= PWinGravity;
+ }
+
+ /* FIXME constrain the window to these hints */
+
+ return meta_error_trap_pop (window->display);
+}
+
+static int
+update_title (MetaWindow *window)
+{
+ XTextProperty text;
+
+ meta_error_trap_push (window->display);
+
+ if (window->title)
+ {
+ g_free (window->title);
+ window->title = NULL;
+ }
+
+ /* FIXME How does memory management for text.value work? */
+ XGetTextProperty (window->display->xdisplay,
+ window->xwindow,
+ &text,
+ window->display->atom_net_wm_name);
+
+ if (text.nitems > 0 &&
+ text.format == 8 &&
+ g_utf8_validate (text.value, text.nitems, NULL))
+ {
+ meta_verbose ("Using _NET_WM_NAME for new title of %s: '%s'\n",
+ window->desc, text.value);
+
+ window->title = g_strdup (text.value);
+ }
+
+ if (window->title == NULL &&
+ text.nitems > 0)
+ meta_warning ("_NET_WM_NAME property for %s contained invalid UTF-8\n",
+ window->desc);
+
+ if (window->title == NULL)
+ {
+ XGetTextProperty (window->display->xdisplay,
+ window->xwindow,
+ &text,
+ XA_WM_NAME);
+
+ if (text.nitems > 0)
+ {
+ /* FIXME This isn't particularly correct. Need to copy the
+ * GDK code...
+ */
+ char *str;
+ GError *err;
+
+ err = NULL;
+ str = g_locale_to_utf8 (text.value,
+ (text.format / 8) * text.nitems,
+ NULL, NULL,
+ &err);
+ if (err != NULL)
+ {
+ meta_warning ("WM_NAME property for %s contained stuff we are too dumb to figure out: %s\n", window->desc, err->message);
+ g_error_free (err);
+ }
+
+ if (window->title)
+ meta_verbose ("Using WM_NAME for new title of %s: '%s'\n",
+ window->desc, text.value);
+
+ window->title = str;
+ }
+ }
+
+ if (window->title == NULL)
+ window->title = g_strdup ("");
+
+ window->desc = g_strdup_printf ("0x%lx (%.10s)", window->xwindow, window->title);
+
+ return meta_error_trap_pop (window->display);
+}
+
+static int
+update_protocols (MetaWindow *window)
+{
+ Atom *protocols;
+ int n_protocols;
+ int i;
+
+ meta_error_trap_push (window->display);
+ XGetWMProtocols (window->display->xdisplay,
+ window->xwindow,
+ &protocols,
+ &n_protocols);
+
+ window->take_focus = FALSE;
+ window->delete_window = FALSE;
+ i = 0;
+ while (i < n_protocols)
+ {
+ if (protocols[i] == _XA_WM_TAKE_FOCUS)
+ window->takes_focus = TRUE;
+ else if (protocols[i] == _XA_WM_DELETE_WINDOW)
+ window->delete_window = TRUE;
+ ++i;
+ }
+
+ if (protocols)
+ XFree (protocols);
+
+ return meta_error_trap_pop (window->display);
+}
+
+static void
+constrain_size (MetaWindow *window,
+ int width, int height,
+ int *new_width, int *new_height)
+{
+ /* This is partially borrowed from GTK (LGPL), which in turn
+ * partially borrowed from fvwm,
+ *
+ * Copyright 1993, Robert Nation
+ * You may use this code for any purpose, as long as the original
+ * copyright remains in the source code and all documentation
+ *
+ * which in turn borrows parts of the algorithm from uwm
+ */
+ int delta;
+ double min_aspect, max_aspect;
+
+#define FLOOR(value, base) ( ((gint) ((value) / (base))) * (base) )
+
+ /* clamp width and height to min and max values
+ */
+ width = CLAMP (width,
+ window->size_hints.min_width,
+ window->size_hints.max_width);
+ height = CLAMP (height,
+ window->size_hints.min_height,
+ window->size_hints.max_height);
+
+ /* shrink to base + N * inc
+ */
+ width = window->size_hints.base_width +
+ FLOOR (width - window->size_hints.base_width, window->size_hints.width_inc);
+ height = window->size_hints.base_height +
+ FLOOR (height - window->size_hints.base_height, window->size_hints.height_inc);
+
+ /* constrain aspect ratio, according to:
+ *
+ * width
+ * min_aspect <= -------- <= max_aspect
+ * height
+ */
+
+ min_aspect = window->size_hints.min_aspect.x / (double) window->size_hints.min_aspect.y;
+ max_aspect = window->size_hints.max_aspect.x / (double) window->size_hints.max_aspect.y;
+
+ if (min_aspect * height > width)
+ {
+ delta = FLOOR (height - width * min_aspect, window->size_hints.height_inc);
+ if (height - delta >= window->size_hints.min_height)
+ height -= delta;
+ else
+ {
+ delta = FLOOR (height * min_aspect - width, window->size_hints.width_inc);
+ if (width + delta <= window->size_hints.max_width)
+ width += delta;
+ }
+ }
+
+ if (max_aspect * height < width)
+ {
+ delta = FLOOR (width - height * max_aspect, window->size_hints.width_inc);
+ if (width - delta >= window->size_hints.min_width)
+ width -= delta;
+ else
+ {
+ delta = FLOOR (width / max_aspect - height, window->size_hints.height_inc);
+ if (height + delta <= window->size_hints.max_height)
+ height += delta;
+ }
+ }
+
+#undef FLOOR
+
+ *new_width = width;
+ *new_height = height;
+}
diff --git a/src/window.h b/src/window.h
index 367c143..4b465a8 100644
--- a/src/window.h
+++ b/src/window.h
@@ -24,6 +24,7 @@
#include "screen.h"
#include "util.h"
+#include <X11/Xutil.h>
struct _MetaWindow
{
@@ -32,19 +33,33 @@ struct _MetaWindow
Window xwindow;
/* may be NULL! not all windows get decorated */
MetaFrame *frame;
- MetaRectangle rect;
- int border_width;
- int win_gravity;
int depth;
Visual *xvisual;
+ char *desc; /* used in debug spew */
char *title;
+
+ guint iconic : 1;
+ guint take_focus : 1;
+ guint delete_window : 1;
+
+ /* The size we set the window to last. */
+ MetaRectangle rect;
+
+ /* Requested geometry */
+ int border_width;
+ /* x/y/w/h here get filled with ConfigureRequest values */
+ XSizeHints size_hints;
};
MetaWindow* meta_window_new (MetaDisplay *display,
Window xwindow);
void meta_window_free (MetaWindow *window);
+void meta_window_show (MetaWindow *window);
+void meta_window_hide (MetaWindow *window);
gboolean meta_window_event (MetaWindow *window,
XEvent *event);
+
+
#endif
diff --git a/stamp.h.in b/stamp.h.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/stamp.h.in