зеркало из https://github.com/mozilla/gecko-dev.git
Bug 726479 - Use GTK's support for startup notifications, r=karlt
Original author: Ben Iofel <iofelben@gmail.com> Differential Revision: https://phabricator.services.mozilla.com/D58594 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8d9da461e2
Коммит
b92dbf5479
|
@ -1267,16 +1267,6 @@ if CONFIG['MOZ_SYSTEM_ZLIB']:
|
|||
'zlib.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
|
||||
system_headers += [
|
||||
'libsn/sn-common.h',
|
||||
'libsn/sn.h',
|
||||
'libsn/sn-launchee.h',
|
||||
'libsn/sn-launcher.h',
|
||||
'libsn/sn-monitor.h',
|
||||
'libsn/sn-util.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_SYSTEM_LIBEVENT']:
|
||||
system_headers += [
|
||||
'event2/event_compat.h',
|
||||
|
|
|
@ -61,7 +61,6 @@ GTK2_VERSION=2.18.0
|
|||
GTK3_VERSION=3.4.0
|
||||
GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
|
||||
W32API_VERSION=3.14
|
||||
STARTUP_NOTIFICATION_VERSION=0.8
|
||||
DBUS_VERSION=0.60
|
||||
SQLITE_VERSION=3.30.1
|
||||
|
||||
|
@ -1759,40 +1758,6 @@ fi # COMPILE_ENVIRONMENT
|
|||
|
||||
AC_SUBST(MOZ_FS_LAYOUT)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = startup-notification support module
|
||||
dnl ========================================================
|
||||
|
||||
if test "$MOZ_ENABLE_GTK"
|
||||
then
|
||||
MOZ_ENABLE_STARTUP_NOTIFICATION=
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(startup-notification,
|
||||
[ --enable-startup-notification
|
||||
Enable startup-notification support (default: disabled) ],
|
||||
MOZ_ENABLE_STARTUP_NOTIFICATION=force,
|
||||
MOZ_ENABLE_STARTUP_NOTIFICATION=)
|
||||
if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
|
||||
then
|
||||
PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
|
||||
libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
|
||||
[MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
|
||||
if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
|
||||
then
|
||||
AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
|
||||
fi
|
||||
MOZ_ENABLE_STARTUP_NOTIFICATION=
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
|
||||
AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
|
||||
fi
|
||||
|
||||
TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
|
||||
fi
|
||||
AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
|
||||
|
||||
AC_SUBST_LIST(TK_CFLAGS)
|
||||
AC_SUBST_LIST(TK_LIBS)
|
||||
|
||||
|
|
|
@ -285,9 +285,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
|
|||
'gthread-2.0',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
|
||||
OS_LIBS += CONFIG['MOZ_STARTUP_NOTIFICATION_LIBS']
|
||||
|
||||
if CONFIG['MOZ_ENABLE_LIBPROXY']:
|
||||
OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
|
||||
|
||||
|
|
|
@ -278,7 +278,6 @@ nsString gAbsoluteArgv0Path;
|
|||
# ifdef MOZ_X11
|
||||
# include <gdk/gdkx.h>
|
||||
# endif /* MOZ_X11 */
|
||||
# include "nsGTKToolkit.h"
|
||||
# include <fontconfig/fontconfig.h>
|
||||
#endif
|
||||
#include "BinaryPath.h"
|
||||
|
@ -3851,7 +3850,6 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
|||
#endif
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
g_set_application_name(mAppData->name);
|
||||
gtk_window_set_auto_startup_notification(false);
|
||||
|
||||
#endif /* defined(MOZ_WIDGET_GTK) */
|
||||
#ifdef MOZ_X11
|
||||
|
@ -4492,10 +4490,6 @@ nsresult XREMain::XRE_mainRun() {
|
|||
#endif
|
||||
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
|
||||
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
|
||||
if (toolkit && !mDesktopStartupID.IsEmpty()) {
|
||||
toolkit->SetDesktopStartupID(mDesktopStartupID);
|
||||
}
|
||||
// Clear the environment variable so it won't be inherited by
|
||||
// child processes and confuse things.
|
||||
g_unsetenv("DESKTOP_STARTUP_ID");
|
||||
|
|
|
@ -146,8 +146,6 @@ DEFINES['CAIRO_GFX'] = True
|
|||
|
||||
DEFINES['MOZ_APP_NAME'] = '"%s"' % CONFIG['MOZ_APP_NAME']
|
||||
|
||||
CFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
|
||||
|
||||
# When building with GTK3, the widget code always needs to use
|
||||
# system Cairo headers, regardless of whether we are also linked
|
||||
# against and using in-tree Cairo. By not using in-tree Cairo
|
||||
|
@ -158,8 +156,6 @@ CFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
|
|||
if not (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk' and CONFIG['MOZ_TREE_CAIRO']):
|
||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
|
||||
CXXFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
|
||||
|
||||
CFLAGS += CONFIG['TK_CFLAGS']
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
|
|
|
@ -529,6 +529,7 @@ STUB(gtk_window_set_geometry_hints)
|
|||
STUB(gtk_window_set_icon_name)
|
||||
STUB(gtk_window_set_modal)
|
||||
STUB(gtk_window_set_skip_taskbar_hint)
|
||||
STUB(gtk_window_set_startup_id)
|
||||
STUB(gtk_window_set_title)
|
||||
STUB(gtk_window_set_transient_for)
|
||||
STUB(gtk_window_set_type_hint)
|
||||
|
|
|
@ -68,11 +68,6 @@
|
|||
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
|
||||
# define SN_API_NOT_YET_FROZEN
|
||||
# include <startup-notification-1.0/libsn/sn.h>
|
||||
#endif
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -1534,8 +1529,6 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) {
|
|||
|
||||
typedef void (*SetUserTimeFunc)(GdkWindow* aWindow, guint32 aTimestamp);
|
||||
|
||||
// This will become obsolete when new GTK APIs are widely supported,
|
||||
// as described here: http://bugzilla.gnome.org/show_bug.cgi?id=347375
|
||||
static void SetUserTimeAndStartupIDForActivatedWindow(GtkWidget* aWindow) {
|
||||
nsGTKToolkit* GTKToolkit = nsGTKToolkit::GetToolkit();
|
||||
if (!GTKToolkit) return;
|
||||
|
@ -1555,35 +1548,7 @@ static void SetUserTimeAndStartupIDForActivatedWindow(GtkWidget* aWindow) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(MOZ_ENABLE_STARTUP_NOTIFICATION)
|
||||
// TODO - Implement for non-X11 Gtk backends (Bug 726479)
|
||||
if (gfxPlatformGtk::GetPlatform()->IsX11Display()) {
|
||||
GdkWindow* gdkWindow = gtk_widget_get_window(aWindow);
|
||||
|
||||
GdkScreen* screen = gdk_window_get_screen(gdkWindow);
|
||||
SnDisplay* snd = sn_display_new(
|
||||
gdk_x11_display_get_xdisplay(gdk_window_get_display(gdkWindow)),
|
||||
nullptr, nullptr);
|
||||
if (!snd) return;
|
||||
SnLauncheeContext* ctx = sn_launchee_context_new(
|
||||
snd, gdk_screen_get_number(screen), desktopStartupID.get());
|
||||
if (!ctx) {
|
||||
sn_display_unref(snd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sn_launchee_context_get_id_has_timestamp(ctx)) {
|
||||
gdk_x11_window_set_user_time(gdkWindow,
|
||||
sn_launchee_context_get_timestamp(ctx));
|
||||
}
|
||||
|
||||
sn_launchee_context_setup_window(ctx, gdk_x11_window_get_xid(gdkWindow));
|
||||
sn_launchee_context_complete(ctx);
|
||||
|
||||
sn_launchee_context_unref(ctx);
|
||||
sn_display_unref(snd);
|
||||
}
|
||||
#endif
|
||||
gtk_window_set_startup_id(GTK_WINDOW(aWindow), desktopStartupID.get());
|
||||
|
||||
// If we used the startup ID, that already contains the focus timestamp;
|
||||
// we don't want to reuse the timestamp next time we raise the window
|
||||
|
|
Загрузка…
Ссылка в новой задаче