зеркало из https://github.com/mozilla/gecko-dev.git
Back out dd103ec4c44b through fba3a342a530 because of B2G test failures on a CLOSED TREE
--HG-- rename : toolkit/system/gnome/nsSystemAlertsService.cpp => toolkit/system/gnome/nsAlertsService.cpp rename : toolkit/system/gnome/nsSystemAlertsService.h => toolkit/system/gnome/nsAlertsService.h
This commit is contained in:
Родитель
437779e7fe
Коммит
9c635d6d0f
|
@ -242,6 +242,8 @@ public:
|
|||
|
||||
virtual bool SetupLookupFunction() = 0;
|
||||
|
||||
virtual void WindowDestroyed() {}
|
||||
|
||||
virtual void ReleaseSurface() {}
|
||||
|
||||
void *GetUserData(void *aKey) {
|
||||
|
|
|
@ -3566,16 +3566,16 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
|
|||
// if a resizer is present, get its size. Assume a default size of 15 pixels.
|
||||
nsSize resizerSize;
|
||||
nscoord defaultSize = nsPresContext::CSSPixelsToAppUnits(15);
|
||||
resizerSize.width = mVScrollbarBox ?
|
||||
mVScrollbarBox->GetPrefSize(aState).width : defaultSize;
|
||||
resizerSize.width =
|
||||
mVScrollbarBox ? mVScrollbarBox->GetMinSize(aState).width : defaultSize;
|
||||
if (resizerSize.width > r.width) {
|
||||
r.width = resizerSize.width;
|
||||
if (aContentArea.x == mScrollPort.x && !scrollbarOnLeft)
|
||||
r.x = aContentArea.XMost() - r.width;
|
||||
}
|
||||
|
||||
resizerSize.height = mHScrollbarBox ?
|
||||
mHScrollbarBox->GetPrefSize(aState).height : defaultSize;
|
||||
resizerSize.height =
|
||||
mHScrollbarBox ? mHScrollbarBox->GetMinSize(aState).height : defaultSize;
|
||||
if (resizerSize.height > r.height) {
|
||||
r.height = resizerSize.height;
|
||||
if (aContentArea.y == mScrollPort.y)
|
||||
|
|
|
@ -18,7 +18,7 @@ FAIL_ON_WARNINGS = 1
|
|||
|
||||
CPPSRCS = \
|
||||
nsGnomeModule.cpp \
|
||||
nsSystemAlertsService.cpp \
|
||||
nsAlertsService.cpp \
|
||||
nsAlertsIconListener.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsAlertsService.h"
|
||||
#include "nsAlertsIconListener.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsAlertsService)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsAlertsService)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsAlertsService)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
nsAlertsService::nsAlertsService()
|
||||
{}
|
||||
|
||||
nsAlertsService::~nsAlertsService()
|
||||
{}
|
||||
|
||||
nsresult
|
||||
nsAlertsService::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl, const nsAString & aAlertTitle,
|
||||
const nsAString & aAlertText, bool aAlertTextClickable,
|
||||
const nsAString & aAlertCookie,
|
||||
nsIObserver * aAlertListener,
|
||||
const nsAString & aAlertName)
|
||||
{
|
||||
nsRefPtr<nsAlertsIconListener> alertListener = new nsAlertsIconListener();
|
||||
if (!alertListener)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
|
||||
aAlertCookie, aAlertListener);
|
||||
}
|
|
@ -3,20 +3,20 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsSystemAlertsService_h__
|
||||
#define nsSystemAlertsService_h__
|
||||
#ifndef nsAlertsService_h__
|
||||
#define nsAlertsService_h__
|
||||
|
||||
#include "nsIAlertsService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSystemAlertsService : public nsIAlertsService
|
||||
class nsAlertsService : public nsIAlertsService
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIALERTSSERVICE
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsSystemAlertsService();
|
||||
virtual ~nsSystemAlertsService();
|
||||
nsAlertsService();
|
||||
virtual ~nsAlertsService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
|
@ -24,4 +24,4 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
#endif /* nsSystemAlertsService_h__ */
|
||||
#endif /* nsAlertsService_h__ */
|
|
@ -22,8 +22,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
|
||||
#endif
|
||||
#include "nsSystemAlertsService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
|
||||
#include "nsAlertsService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAlertsService, Init)
|
||||
|
||||
#ifdef MOZ_ENABLE_GCONF
|
||||
NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
|
||||
|
@ -49,7 +49,7 @@ static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
|
|||
{ &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
|
||||
{ &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
|
||||
#endif
|
||||
{ &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, nsSystemAlertsServiceConstructor },
|
||||
{ &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, nsAlertsServiceConstructor },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSystemAlertsService.h"
|
||||
#include "nsAlertsIconListener.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsSystemAlertsService)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsSystemAlertsService)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSystemAlertsService)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
nsSystemAlertsService::nsSystemAlertsService()
|
||||
{}
|
||||
|
||||
nsSystemAlertsService::~nsSystemAlertsService()
|
||||
{}
|
||||
|
||||
nsresult
|
||||
nsSystemAlertsService::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemAlertsService::ShowAlertNotification(const nsAString & aImageUrl,
|
||||
const nsAString & aAlertTitle,
|
||||
const nsAString & aAlertText,
|
||||
bool aAlertTextClickable,
|
||||
const nsAString & aAlertCookie,
|
||||
nsIObserver * aAlertListener,
|
||||
const nsAString & aAlertName)
|
||||
{
|
||||
nsRefPtr<nsAlertsIconListener> alertListener = new nsAlertsIconListener();
|
||||
if (!alertListener)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
|
||||
aAlertCookie, aAlertListener);
|
||||
}
|
|
@ -1168,12 +1168,16 @@ nsDragService::GetSourceList(void)
|
|||
|
||||
// the application/x-moz-internal-item-list format, which preserves
|
||||
// all information for drags within the same mozilla instance.
|
||||
GdkAtom listAtom = gdk_atom_intern(gMimeListType, FALSE);
|
||||
GtkTargetEntry *listTarget =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
listTarget->target = g_strdup(gMimeListType);
|
||||
listTarget->flags = 0;
|
||||
/* Bug 331198 */
|
||||
listTarget->info = NS_PTR_TO_UINT32(listAtom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("automatically adding target %s\n", listTarget->target));
|
||||
("automatically adding target %s with id %ld\n",
|
||||
listTarget->target, listAtom));
|
||||
targetArray.AppendElement(listTarget);
|
||||
|
||||
// check what flavours are supported so we can decide what other
|
||||
|
@ -1204,13 +1208,16 @@ nsDragService::GetSourceList(void)
|
|||
// If so, advertise
|
||||
// text/uri-list.
|
||||
if (strcmp(flavorStr, kURLMime) == 0) {
|
||||
listAtom = gdk_atom_intern(gTextUriListType, FALSE);
|
||||
listTarget =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
listTarget->target = g_strdup(gTextUriListType);
|
||||
listTarget->flags = 0;
|
||||
/* Bug 331198 */
|
||||
listTarget->info = NS_PTR_TO_UINT32(listAtom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("automatically adding target %s\n",
|
||||
listTarget->target));
|
||||
("automatically adding target %s with \
|
||||
id %ld\n", listTarget->target, listAtom));
|
||||
targetArray.AppendElement(listTarget);
|
||||
}
|
||||
}
|
||||
|
@ -1238,47 +1245,67 @@ nsDragService::GetSourceList(void)
|
|||
if (currentFlavor) {
|
||||
nsXPIDLCString flavorStr;
|
||||
currentFlavor->ToString(getter_Copies(flavorStr));
|
||||
// get the atom
|
||||
GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
|
||||
GtkTargetEntry *target =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
target->target = g_strdup(flavorStr);
|
||||
target->flags = 0;
|
||||
/* Bug 331198 */
|
||||
target->info = NS_PTR_TO_UINT32(atom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("adding target %s\n", target->target));
|
||||
("adding target %s with id %ld\n",
|
||||
target->target, atom));
|
||||
targetArray.AppendElement(target);
|
||||
// Check to see if this is text/unicode.
|
||||
// If it is, add text/plain
|
||||
// since we automatically support text/plain
|
||||
// if we support text/unicode.
|
||||
if (strcmp(flavorStr, kUnicodeMime) == 0) {
|
||||
// get the atom for the unicode string
|
||||
GdkAtom plainUTF8Atom =
|
||||
gdk_atom_intern(gTextPlainUTF8Type, FALSE);
|
||||
GtkTargetEntry *plainUTF8Target =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
plainUTF8Target->target = g_strdup(gTextPlainUTF8Type);
|
||||
plainUTF8Target->flags = 0;
|
||||
/* Bug 331198 */
|
||||
plainUTF8Target->info = NS_PTR_TO_UINT32(plainUTF8Atom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("automatically adding target %s\n",
|
||||
plainUTF8Target->target));
|
||||
("automatically adding target %s with \
|
||||
id %ld\n", plainUTF8Target->target, plainUTF8Atom));
|
||||
targetArray.AppendElement(plainUTF8Target);
|
||||
|
||||
// get the atom for the ASCII string
|
||||
GdkAtom plainAtom =
|
||||
gdk_atom_intern(kTextMime, FALSE);
|
||||
GtkTargetEntry *plainTarget =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
plainTarget->target = g_strdup(kTextMime);
|
||||
plainTarget->flags = 0;
|
||||
/* Bug 331198 */
|
||||
plainTarget->info = NS_PTR_TO_UINT32(plainAtom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("automatically adding target %s\n",
|
||||
plainTarget->target));
|
||||
("automatically adding target %s with \
|
||||
id %ld\n", plainTarget->target, plainAtom));
|
||||
targetArray.AppendElement(plainTarget);
|
||||
}
|
||||
// Check to see if this is the x-moz-url type.
|
||||
// If it is, add _NETSCAPE_URL
|
||||
// this is a type used by everybody.
|
||||
if (strcmp(flavorStr, kURLMime) == 0) {
|
||||
// get the atom name for it
|
||||
GdkAtom urlAtom =
|
||||
gdk_atom_intern(gMozUrlType, FALSE);
|
||||
GtkTargetEntry *urlTarget =
|
||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
|
||||
urlTarget->target = g_strdup(gMozUrlType);
|
||||
urlTarget->flags = 0;
|
||||
/* Bug 331198 */
|
||||
urlTarget->info = NS_PTR_TO_UINT32(urlAtom);
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||
("automatically adding target %s\n",
|
||||
urlTarget->target));
|
||||
("automatically adding target %s with \
|
||||
id %ld\n", urlTarget->target, urlAtom));
|
||||
targetArray.AppendElement(urlTarget);
|
||||
}
|
||||
}
|
||||
|
@ -1299,7 +1326,7 @@ nsDragService::GetSourceList(void)
|
|||
// this is a string reference but it will be freed later.
|
||||
targets[targetIndex].target = disEntry->target;
|
||||
targets[targetIndex].flags = disEntry->flags;
|
||||
targets[targetIndex].info = 0;
|
||||
targets[targetIndex].info = disEntry->info;
|
||||
}
|
||||
targetList = gtk_target_list_new(targets, targetCount);
|
||||
// clean up the target list
|
||||
|
@ -1450,13 +1477,14 @@ void
|
|||
nsDragService::SourceDataGet(GtkWidget *aWidget,
|
||||
GdkDragContext *aContext,
|
||||
GtkSelectionData *aSelectionData,
|
||||
guint aInfo,
|
||||
guint32 aTime)
|
||||
{
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::SourceDataGet"));
|
||||
GdkAtom target = gtk_selection_data_get_target(aSelectionData);
|
||||
GdkAtom atom = (GdkAtom)aInfo;
|
||||
nsXPIDLCString mimeFlavor;
|
||||
gchar *typeName = 0;
|
||||
typeName = gdk_atom_name(target);
|
||||
typeName = gdk_atom_name(atom);
|
||||
if (!typeName) {
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("failed to get atom name.\n"));
|
||||
return;
|
||||
|
@ -1539,7 +1567,8 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
|
|||
}
|
||||
if (tmpData) {
|
||||
// this copies the data
|
||||
gtk_selection_data_set(aSelectionData, target,
|
||||
gtk_selection_data_set(aSelectionData,
|
||||
gtk_selection_data_get_target(aSelectionData),
|
||||
8,
|
||||
(guchar *)tmpData, tmpDataLen);
|
||||
// this wasn't allocated with glib
|
||||
|
@ -1551,7 +1580,8 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
|
|||
gchar *uriList;
|
||||
gint length;
|
||||
CreateUriList(mSourceDataItems, &uriList, &length);
|
||||
gtk_selection_data_set(aSelectionData, target,
|
||||
gtk_selection_data_set(aSelectionData,
|
||||
gtk_selection_data_get_target(aSelectionData),
|
||||
8, (guchar *)uriList, length);
|
||||
g_free(uriList);
|
||||
return;
|
||||
|
@ -1630,7 +1660,7 @@ invisibleSourceDragDataGet(GtkWidget *aWidget,
|
|||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("invisibleSourceDragDataGet"));
|
||||
nsDragService *dragService = (nsDragService *)aData;
|
||||
dragService->SourceDataGet(aWidget, aContext,
|
||||
aSelectionData, aTime);
|
||||
aSelectionData, aInfo, aTime);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
void SourceDataGet(GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint32 aTime);
|
||||
|
||||
// set the drag icon during drag-begin
|
||||
|
|
|
@ -1052,9 +1052,9 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
|
|||
moz_gtk_get_scrollbar_metrics(&metrics);
|
||||
|
||||
if (aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL)
|
||||
aResult->width = metrics.slider_width + 2 * metrics.trough_border;
|
||||
aResult->width = metrics.slider_width;
|
||||
else
|
||||
aResult->height = metrics.slider_width + 2 * metrics.trough_border;
|
||||
aResult->height = metrics.slider_width;
|
||||
|
||||
*aIsOverridable = false;
|
||||
}
|
||||
|
|
|
@ -565,11 +565,6 @@ xt_client_create ( XtClient* xtclient ,
|
|||
void
|
||||
xt_client_unrealize ( XtClient* xtclient )
|
||||
{
|
||||
/* Explicitly destroy the child_widget window because this is actually a
|
||||
child of the socket window. It is not a child of top_widget's window
|
||||
when that is destroyed. */
|
||||
XtUnrealizeWidget(xtclient->child_widget);
|
||||
|
||||
#if XlibSpecificationRelease >= 6
|
||||
XtUnregisterDrawable(xtclient->xtdisplay,
|
||||
xtclient->top_widget->core.window);
|
||||
|
|
Загрузка…
Ссылка в новой задаче