mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 627699 - Port GTK2 to GTK3, toolkit part, r=karlt
This commit is contained in:
parent
2e3eaebbc4
commit
b057ab26b1
@ -1,4 +1,4 @@
|
||||
component {54ae32f8-1dd2-11b2-a209-df7c505370f8} nsFilePicker.js
|
||||
#ifndef MOZ_WIDGET_GTK2
|
||||
#ifndef MOZ_WIDGET_GTK
|
||||
contract @mozilla.org/filepicker;1 {54ae32f8-1dd2-11b2-a209-df7c505370f8}
|
||||
#endif
|
||||
|
@ -155,7 +155,11 @@ nsGTKRemoteService::HandleCommandsFor(GtkWidget* widget,
|
||||
|
||||
gtk_widget_add_events(widget, GDK_PROPERTY_CHANGE_MASK);
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
Window window = GDK_WINDOW_XWINDOW(widget->window);
|
||||
#else
|
||||
Window window = gdk_x11_window_get_xid(gtk_widget_get_window(widget));
|
||||
#endif
|
||||
nsXRemoteService::HandleCommandsFor(window);
|
||||
|
||||
}
|
||||
@ -168,8 +172,13 @@ nsGTKRemoteService::HandlePropertyChange(GtkWidget *aWidget,
|
||||
if (pevent->state == GDK_PROPERTY_NEW_VALUE) {
|
||||
Atom changedAtom = gdk_x11_atom_to_xatom(pevent->atom);
|
||||
|
||||
return HandleNewProperty(GDK_WINDOW_XWINDOW(pevent->window),
|
||||
GDK_DISPLAY(),
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
XID window = GDK_WINDOW_XWINDOW(pevent->window);
|
||||
#else
|
||||
XID window = gdk_x11_window_get_xid(gtk_widget_get_window(aWidget));
|
||||
#endif
|
||||
return HandleNewProperty(window,
|
||||
GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
|
||||
pevent->time, changedAtom, aThis);
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -185,7 +185,7 @@
|
||||
<xul:label anonid="find-label" class="findbar-find-fast" control="findbar-textbox"/>
|
||||
<xul:textbox class="findbar-textbox findbar-find-fast" anonid="findbar-textbox"
|
||||
xbl:inherits="flash"/>
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
<xul:toolbarbutton anonid="find-previous"
|
||||
class="findbar-find-previous tabbable"
|
||||
label="&previous.label;"
|
||||
@ -203,7 +203,7 @@
|
||||
oncommand="onFindAgainCommand(false);"
|
||||
disabled="true"
|
||||
xbl:inherits="accesskey=findnextaccesskey"/>
|
||||
#ifndef MOZ_WIDGET_GTK2
|
||||
#ifndef MOZ_WIDGET_GTK
|
||||
<xul:toolbarbutton anonid="find-previous"
|
||||
class="findbar-find-previous tabbable"
|
||||
label="&previous.label;"
|
||||
|
@ -577,7 +577,7 @@
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll">
|
||||
<![CDATA[
|
||||
|
@ -140,7 +140,7 @@ button[type="menu-button"] {
|
||||
-moz-binding: url("chrome://global/content/bindings/button.xml#menu-button");
|
||||
}
|
||||
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
/********* detection of system setting to use icons in buttons ***********/
|
||||
button[label]:not([label=""]) > .button-box > .button-icon:not(:-moz-system-metric(images-in-buttons)),
|
||||
button[label]:not([label=""]) > .button-box > .box-inherit > .button-icon:not(:-moz-system-metric(images-in-buttons)) {
|
||||
@ -368,7 +368,7 @@ menuitem.menuitem-non-iconic {
|
||||
-moz-binding: url("chrome://global/content/bindings/menu.xml#menubutton-item");
|
||||
}
|
||||
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
/********* detection of system setting to use icons in menus ***********/
|
||||
@media not all and (-moz-images-in-menus) {
|
||||
.menu-iconic-left {
|
||||
|
@ -36,7 +36,7 @@
|
||||
# define WIDGET_MODULES MODULE(nsWidgetMacModule)
|
||||
#elif defined(XP_OS2)
|
||||
# define WIDGET_MODULES MODULE(nsWidgetOS2Module)
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
# define WIDGET_MODULES MODULE(nsWidgetGtk2Module)
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
# define WIDGET_MODULES MODULE(nsWidgetQtModule)
|
||||
@ -67,7 +67,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_PREF_EXTENSIONS
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#ifdef MOZ_ENABLE_GTK
|
||||
#define SYSTEMPREF_MODULES \
|
||||
MODULE(nsAutoConfigModule)
|
||||
#else
|
||||
@ -125,7 +125,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#ifdef MOZ_ENABLE_GTK
|
||||
#define UNIXPROXY_MODULE MODULE(nsUnixProxyModule)
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
#exclam
|
||||
{
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
list-style-image: url("moz-icon://stock/gtk-dialog-warning?size=dialog");
|
||||
%else
|
||||
list-style-image: url("chrome://global/skin/icons/warning-large.png");
|
||||
|
@ -96,7 +96,7 @@ td:not(:first-child) {
|
||||
-moz-margin-end: 4px;
|
||||
-moz-margin-start: -20px;
|
||||
vertical-align: middle;
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
content: url(moz-icon://stock/gtk-go-up?size=menu);
|
||||
%else
|
||||
content: url(chrome://global/skin/dirListing/up.png);
|
||||
@ -104,7 +104,7 @@ td:not(:first-child) {
|
||||
}
|
||||
|
||||
.dir::before {
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
content: url(moz-icon://stock/gtk-directory?size=menu);
|
||||
%else
|
||||
content: url(chrome://global/skin/dirListing/folder.png);
|
||||
|
@ -211,7 +211,7 @@ static int gQtOnlyArgc;
|
||||
static char **gQtOnlyArgv;
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#if defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) \
|
||||
|| defined(NS_TRACE_MALLOC)
|
||||
#define CLEANUP_MEMORY 1
|
||||
@ -2509,7 +2509,7 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include "prlink.h"
|
||||
typedef void (*_g_set_application_name_fn)(const gchar *application_name);
|
||||
typedef void (*_gtk_window_set_auto_startup_notification_fn)(gboolean setting);
|
||||
@ -2706,7 +2706,7 @@ public:
|
||||
#ifdef MOZ_ENABLE_XREMOTE
|
||||
, mDisableRemote(false)
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
, mGdkDisplay(nsnull)
|
||||
#endif
|
||||
{};
|
||||
@ -2747,7 +2747,7 @@ public:
|
||||
bool mDisableRemote;
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
GdkDisplay* mGdkDisplay;
|
||||
#endif
|
||||
};
|
||||
@ -3162,7 +3162,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
return 1;
|
||||
*aExitFlag = false;
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_ENABLE_XREMOTE)
|
||||
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_ENABLE_XREMOTE)
|
||||
// Stash DESKTOP_STARTUP_ID in malloc'ed memory because gtk_init will clear it.
|
||||
#define HAVE_DESKTOP_STARTUP_ID
|
||||
const char* desktopStartupIDEnv = PR_GetEnv("DESKTOP_STARTUP_ID");
|
||||
@ -3202,13 +3202,15 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
}
|
||||
gQtOnlyArgv[gQtOnlyArgc] = nsnull;
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// setup for private colormap. Ideally we'd like to do this
|
||||
// in nsAppShell::Create, but we need to get in before gtk
|
||||
// has been initialized to make sure everything is running
|
||||
// consistently.
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (CheckArg("install"))
|
||||
gdk_rgb_set_install(TRUE);
|
||||
#endif
|
||||
|
||||
// Initialize GTK here for splash.
|
||||
|
||||
@ -3281,7 +3283,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
XInitThreads();
|
||||
}
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
mGdkDisplay = gdk_display_open(display_name);
|
||||
if (!mGdkDisplay) {
|
||||
PR_fprintf(PR_STDERR, "Error: cannot open display: %s\n", display_name);
|
||||
@ -3302,8 +3304,10 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
_gtk_window_set_auto_startup_notification(false);
|
||||
}
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_widget_set_default_colormap(gdk_rgb_get_colormap());
|
||||
#endif /* MOZ_WIDGET_GTK2 */
|
||||
#endif /* (MOZ_WIDGET_GTK == 2) */
|
||||
#endif /* defined(MOZ_WIDGET_GTK) */
|
||||
#ifdef MOZ_X11
|
||||
// Do this after initializing GDK, or GDK will install its own handler.
|
||||
InstallX11ErrorHandler();
|
||||
@ -3324,7 +3328,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
|
||||
// DESKTOP_STARTUP_ID is cleared now,
|
||||
// we recover it in case we need a restart.
|
||||
if (!mDesktopStartupID.IsEmpty()) {
|
||||
@ -3709,7 +3713,7 @@ XREMain::XRE_mainRun()
|
||||
rv = appStartup->CreateHiddenWindow();
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
|
||||
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
|
||||
if (toolkit && !mDesktopStartupID.IsEmpty()) {
|
||||
toolkit->SetDesktopStartupID(mDesktopStartupID);
|
||||
@ -3819,7 +3823,7 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
|
||||
ScopedLogging log;
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#ifdef MOZ_MEMORY
|
||||
// Disable the slice allocator, since jemalloc already uses similar layout
|
||||
// algorithms, and using a sub-allocator tends to increase fragmentation.
|
||||
@ -3898,7 +3902,7 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
SaveFileToEnvIfUnset("XRE_PROFILE_LOCAL_PATH", mProfLD);
|
||||
SaveWordToEnvIfUnset("XRE_PROFILE_NAME", mProfileName);
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
MOZ_gdk_display_close(mGdkDisplay);
|
||||
#endif
|
||||
|
||||
@ -3911,7 +3915,7 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// gdk_display_close also calls gdk_display_manager_set_default_display
|
||||
// appropriately when necessary.
|
||||
MOZ_gdk_display_close(mGdkDisplay);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
@ -362,7 +362,7 @@ XRE_InitChildProcess(int aArgc,
|
||||
gArgv = aArgv;
|
||||
gArgc = aArgc;
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
|
||||
|
@ -399,6 +399,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
{
|
||||
NS_ASSERTION(gAppData, "gAppData must not be null.");
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (gtk_major_version < MIN_GTK_MAJOR_VERSION ||
|
||||
(gtk_major_version == MIN_GTK_MAJOR_VERSION && gtk_minor_version < MIN_GTK_MINOR_VERSION)) {
|
||||
GtkWidget* versionErrDialog = gtk_message_dialog_new(NULL,
|
||||
@ -415,6 +416,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
gtk_widget_destroy(versionErrDialog);
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (MOZ_PLATFORM_MAEMO == 5)
|
||||
/* zero state out. */
|
||||
@ -459,7 +461,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
|
||||
*aRetVal = true;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
|
||||
|
||||
PRLibrary *gnomeuiLib = PR_LoadLibrary("libgnomeui-2.so.0");
|
||||
if (!gnomeuiLib)
|
||||
@ -482,7 +484,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif /* MOZ_X11 */
|
||||
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
// We will load gail, atk-bridge by ourself later
|
||||
@ -493,11 +495,11 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
setenv(accEnv, "0", 1);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
|
||||
if (!gnome_program_get()) {
|
||||
gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), gArgc, gArgv, NULL);
|
||||
}
|
||||
#endif /* MOZ_X11 */
|
||||
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
if (accOldValue) {
|
||||
@ -511,7 +513,8 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
// gnome_program_init causes atexit handlers to be registered. Strange
|
||||
// crashes will occur if these libraries are unloaded.
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// TODO GTK3 - see Bug 694570 - Stop using libgnome and libgnomeui on Linux
|
||||
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
|
||||
gnome_client_set_restart_command = (_gnome_client_set_restart_command_fn)
|
||||
PR_FindFunctionSymbol(gnomeuiLib, "gnome_client_set_restart_command");
|
||||
|
||||
@ -554,7 +557,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
|
||||
if (argv1) {
|
||||
gnome_client_set_restart_command(client, 1, &argv1);
|
||||
}
|
||||
#endif /* MOZ_X11 */
|
||||
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -101,12 +101,12 @@ child_ah_crap_handler(int signum)
|
||||
|
||||
#endif // CRAWL_STACK_ON_SIGSEGV
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// Need this include for version test below.
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
||||
#if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
||||
|
||||
static GLogFunc orig_log_func = NULL;
|
||||
|
||||
@ -282,7 +282,7 @@ void InstallSignalHandlers(const char *ProgramName)
|
||||
}
|
||||
#endif //SOLARIS
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
||||
#if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
|
||||
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
|
||||
if (assertString &&
|
||||
(!strcmp(assertString, "suspend") ||
|
||||
|
Loading…
Reference in New Issue
Block a user