Skip to content

Commit

Permalink
Apply startup notification patch from Michael Stapelberg
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikachu committed Nov 13, 2011
1 parent 25be56e commit a4e5c2d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ TODO: split ROW into a ROW_fast (0..total*2-1) and ROW macros?
'focus follows mouse' and the focus is on the main window
but not on the active terminal window (patch by Martin
Pohlack).
- Support for the freedesktop startup-notification protocol (patch by
Michael Stapelberg).

9.12 Wed Jun 29 14:34:28 CEST 2011
- fix regression in processing of SelectionNotify events.
Expand Down
33 changes: 33 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ support_scroll_next=yes
support_scroll_xterm=yes
support_xim=yes
support_pixbuf=yes
support_startup_notification=yes
support_afterimage=yes
support_xft=yes
support_unicode3=no
Expand Down Expand Up @@ -132,6 +133,7 @@ AC_ARG_ENABLE(everything,
support_wtmp=no
support_xim=no
support_pixbuf=no
support_startup_notification=no
support_afterimage=no
support_xft=no
support_unicode3=no
Expand Down Expand Up @@ -160,6 +162,7 @@ AC_ARG_ENABLE(everything,
support_wtmp=yes
support_xim=yes
support_pixbuf=yes
support_startup_notification=yes
support_afterimage=yes
support_xft=yes
support_unicode3=yes
Expand Down Expand Up @@ -250,6 +253,12 @@ AC_ARG_ENABLE(pixbuf,
support_pixbuf=$enableval
fi])

AC_ARG_ENABLE(startup-notification,
[ --enable-startup-notification enable freedesktop startup notification support],
[if test x$enableval = xyes -o x$enableval = xno; then
support_startup_notification=$enableval
fi])

AC_ARG_ENABLE(transparency,
[ --enable-transparency enable transparent backgrounds],
[if test x$enableval = xyes -o x$enableval = xno; then
Expand Down Expand Up @@ -465,6 +474,30 @@ fi
AC_SUBST(PIXBUF_CFLAGS)
AC_SUBST(PIXBUF_LIBS)

STARTUP_NOTIFICATION_CFLAGS=
STARTUP_NOTIFICATION_LIBS=

if test x$support_startup_notification = xyes; then
support_startup_notification=no
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libstartup-notification)
if test $PKG_CONFIG != no && $PKG_CONFIG --exists libstartup-notification-1.0; then
STARTUP_NOTIFICATION_CFLAGS="`$PKG_CONFIG libstartup-notification-1.0 --cflags`"
STARTUP_NOTIFICATION_LIBS="`$PKG_CONFIG libstartup-notification-1.0 --libs`"
support_startup_notification=yes
fi

if test x$support_startup_notification = xyes; then
AC_MSG_RESULT(ok)
AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, Define if freedesktop startup notifications should be supported)
else
AC_MSG_RESULT(no)
fi
fi

AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
AC_SUBST(STARTUP_NOTIFICATION_LIBS)

AFTERIMAGE_CFLAGS=
AFTERIMAGE_LIBS=
AFTERIMAGE_VERSION=
Expand Down
5 changes: 5 additions & 0 deletions doc/rxvt.7.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,11 @@ Add support for GDK-PixBuf to be used for background images.
It adds support for many file formats including JPG, PNG,
TIFF, GIF, XPM, BMP, ICO and TGA.

=item --enable-startup-notification (default: on)

Add support for freedesktop startup notifications. This allows window managers
to display some kind of progress indicator during startup.

=item --enable-transparency (default: on)

Add support for using the root pixmap as background to simulate transparency.
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
LIBS = @LIBS@
XINC = @X_CFLAGS@ @AFTERIMAGE_CFLAGS@ @PIXBUF_CFLAGS@
XLIB = @X_LIBS@ @AFTERIMAGE_LIBS@ -lX11 @X_EXTRA_LIBS@ @PIXBUF_LIBS@
XINC = @X_CFLAGS@ @AFTERIMAGE_CFLAGS@ @PIXBUF_CFLAGS@ @STARTUP_NOTIFICATION_CFLAGS@
XLIB = @X_LIBS@ @AFTERIMAGE_LIBS@ -lX11 @X_EXTRA_LIBS@ @PIXBUF_LIBS@ @STARTUP_NOTIFICATION_LIBS@
COMPILE = $(CXX) -I.. -I$(srcdir) -I. -I$(srcdir)/../libev -I$(srcdir)/../libptytty/src -I$(srcdir)/../libecb $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(XINC)
LINK = @LINKER@ $(LDFLAGS)
EXEEXT = @EXEEXT@
Expand Down
29 changes: 29 additions & 0 deletions src/init.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
# include <langinfo.h>
#endif

#ifdef HAVE_STARTUP_NOTIFICATION
# define SN_API_NOT_YET_FROZEN
# include <libsn/sn-launchee.h>
#endif

#ifdef DISPLAY_IS_IP
/* On Solaris link with -lsocket and -lnsl */
#include <sys/types.h>
Expand Down Expand Up @@ -872,9 +877,33 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv)
}
#endif

#if HAVE_STARTUP_NOTIFICATION
SnDisplay *snDisplay;
SnLauncheeContext *snContext;

snDisplay = sn_display_new (dpy, NULL, NULL);
snContext = sn_launchee_context_new_from_environment (snDisplay, DefaultScreen (dpy));

/* Tell the window manager that this window is part of the startup context */
if (snContext)
sn_launchee_context_setup_window (snContext, parent);
#endif

XMapWindow (dpy, vt);
XMapWindow (dpy, parent);

#if HAVE_STARTUP_NOTIFICATION
if (snContext)
{
/* Mark the startup process as complete */
sn_launchee_context_complete (snContext);

sn_launchee_context_unref (snContext);
}

sn_display_unref (snDisplay);
#endif

refresh_check ();
}

Expand Down

0 comments on commit a4e5c2d

Please sign in to comment.