Bug 784739 - Switch from NULL to nullptr in widget/gtk/; r=ehsan

--HG--
extra : rebase_source : 538a634157e10b790b8278039101f2247ce37220
This commit is contained in:
Birunthan Mohanathas 2013-10-08 14:47:37 -04:00
parent b823b8896b
commit 5224dcd545
22 changed files with 242 additions and 234 deletions

View File

@ -15,8 +15,8 @@ using mozilla::MutexAutoLock;
namespace {
Mutex* sMutex = NULL;
CondVar* sCondVar = NULL;
Mutex* sMutex = nullptr;
CondVar* sCondVar = nullptr;
bool sTracerProcessed = false;
// This function is called from the main (UI) thread.
@ -41,8 +41,8 @@ void CleanUpWidgetTracing()
{
delete sMutex;
delete sCondVar;
sMutex = NULL;
sCondVar = NULL;
sMutex = nullptr;
sCondVar = nullptr;
}
// This function is called from the background tracer thread.
@ -56,8 +56,8 @@ bool FireAndWaitForTracerEvent()
NS_ABORT_IF_FALSE(!sTracerProcessed, "Tracer synchronization state is wrong");
g_idle_add_full(G_PRIORITY_DEFAULT,
TracerCallback,
NULL,
NULL);
nullptr,
nullptr);
while (!sTracerProcessed)
sCondVar->Wait();
sTracerProcessed = false;

View File

@ -80,8 +80,8 @@ nsAppShell::Init()
#endif
if (!sPollFunc) {
sPollFunc = g_main_context_get_poll_func(NULL);
g_main_context_set_poll_func(NULL, &PollWrapper);
sPollFunc = g_main_context_get_poll_func(nullptr);
g_main_context_set_poll_func(nullptr, &PollWrapper);
}
if (PR_GetEnv("MOZ_DEBUG_PAINTS"))
@ -135,5 +135,5 @@ nsAppShell::ScheduleNativeEventCallback()
bool
nsAppShell::ProcessNextNativeEvent(bool mayWait)
{
return g_main_context_iteration(NULL, mayWait);
return g_main_context_iteration(nullptr, mayWait);
}

View File

@ -39,7 +39,7 @@ nsBidiKeyboard::Reset()
mHaveBidiKeyboards = false;
if (GdkKeymapHaveBidiLayouts)
mHaveBidiKeyboards = (*GdkKeymapHaveBidiLayouts)(NULL);
mHaveBidiKeyboards = (*GdkKeymapHaveBidiLayouts)(nullptr);
#else
mHaveBidiKeyboards = gdk_keymap_have_bidi_layouts(gdk_keymap_get_default());
#endif

View File

@ -22,7 +22,7 @@ typedef struct /**** Printer Options ****/
typedef struct /**** Destination ****/
{
char *name, /* Printer or class name */
*instance; /* Local instance name or NULL */
*instance; /* Local instance name or nullptr */
int is_default; /* Is this printer the default? */
int num_options; /* Number of options */
cups_option_t *options; /* Options */

View File

@ -146,7 +146,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
EmptyClipboard(aWhichClipboard);
// List of suported targets
GtkTargetList *list = gtk_target_list_new(NULL, 0);
GtkTargetList *list = gtk_target_list_new(nullptr, 0);
// Get the types of supported flavors
nsCOMPtr<nsISupportsArray> flavors;
@ -242,7 +242,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
GtkClipboard *clipboard;
clipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
guchar *data = NULL;
guchar *data = nullptr;
gint length = 0;
bool foundData = false;
nsAutoCString foundFlavor;
@ -399,7 +399,7 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
return NS_OK;
gint n_targets = 0;
GdkAtom *targets = NULL;
GdkAtom *targets = nullptr;
if (!gtk_selection_data_get_targets(selection_data,
&targets, &n_targets) ||
@ -842,7 +842,7 @@ checkEventProc(Display *display, XEvent *event, XPointer arg)
gdk_x11_window_lookup_for_display(gdk_x11_lookup_xdisplay(display),
event->xany.window);
if (cbWindow) {
GtkWidget *cbWidget = NULL;
GtkWidget *cbWidget = nullptr;
gdk_window_get_user_data(cbWindow, (gpointer *)&cbWidget);
if (cbWidget && GTK_IS_WIDGET(cbWidget)) {
context->cbWidget = cbWidget;
@ -916,7 +916,7 @@ RetrievalContext::Wait()
Display *xDisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) ;
checkEventContext context;
context.cbWidget = NULL;
context.cbWidget = nullptr;
context.selAtom = gdk_x11_atom_to_xatom(gdk_atom_intern("GDK_SELECTION",
FALSE));
@ -956,7 +956,7 @@ RetrievalContext::Wait()
tv.tv_sec = 0;
tv.tv_usec = std::max<int32_t>(0,
kClipboardTimeout - (now - start).ToMicroseconds());
select_result = select(cnumber, &select_set, NULL, NULL, &tv);
select_result = select(cnumber, &select_set, nullptr, nullptr, &tv);
} while (select_result == 1 ||
(select_result == -1 && errno == EINTR));

View File

@ -347,10 +347,10 @@ nsTArray<nsString>* GlobalPrinters::mGlobalPrinterList = nullptr;
//---------------
nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
: mPrintJob(NULL)
, mGtkPrinter(NULL)
, mGtkPrintSettings(NULL)
, mGtkPageSetup(NULL)
: mPrintJob(nullptr)
, mGtkPrinter(nullptr)
, mGtkPrintSettings(nullptr)
, mGtkPageSetup(nullptr)
{
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()\n"));
}

View File

@ -48,7 +48,7 @@ enum {
MOZ_GTK_DRAG_RESULT_NO_TARGET
};
static PRLogModuleInfo *sDragLm = NULL;
static PRLogModuleInfo *sDragLm = nullptr;
// data used for synthetic periodic motion events sent to the source widget
// grabbing real events for the drag.
@ -114,7 +114,7 @@ nsDragService::nsDragService()
if (dragFailedID) {
g_signal_connect_closure_by_id(mHiddenWidget, dragFailedID, 0,
g_cclosure_new(G_CALLBACK(invisibleSourceDragFailed),
this, NULL),
this, nullptr),
FALSE);
}
@ -194,7 +194,7 @@ DispatchMotionEventCopy(gpointer aData)
sMotionEventTimerID = 0;
GdkEvent *event = sMotionEvent;
sMotionEvent = NULL;
sMotionEvent = nullptr;
// If there is no longer a grab on the widget, then the drag is over and
// there is no need to continue drag motion.
if (gtk_widget_has_grab(sGrabWidget)) {
@ -246,7 +246,7 @@ OnSourceGrabEventAfter(GtkWidget *widget, GdkEvent *event, gpointer user_data)
// recommends an interval of 350ms +/- 200ms.
sMotionEventTimerID =
g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, 350,
DispatchMotionEventCopy, NULL, NULL);
DispatchMotionEventCopy, nullptr, nullptr);
}
static GtkWindow*
@ -254,30 +254,30 @@ GetGtkWindow(nsIDOMDocument *aDocument)
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
if (!doc)
return NULL;
return nullptr;
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
if (!presShell)
return NULL;
return nullptr;
nsRefPtr<nsViewManager> vm = presShell->GetViewManager();
if (!vm)
return NULL;
return nullptr;
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (!widget)
return NULL;
return nullptr;
GtkWidget *gtkWidget =
static_cast<nsWindow*>(widget.get())->GetMozContainerWidget();
if (!gtkWidget)
return NULL;
return nullptr;
GtkWidget *toplevel = NULL;
GtkWidget *toplevel = nullptr;
toplevel = gtk_widget_get_toplevel(gtkWidget);
if (!GTK_IS_WINDOW(toplevel))
return NULL;
return nullptr;
return GTK_WINDOW(toplevel);
}
@ -342,7 +342,7 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
// Put the drag widget in the window group of the source node so that the
// gtk_grab_add during gtk_drag_begin is effective.
// gtk_window_get_group(NULL) returns the default window group.
// gtk_window_get_group(nullptr) returns the default window group.
GtkWindowGroup *window_group =
gtk_window_get_group(GetGtkWindow(mSourceDocument));
gtk_window_group_add_window(window_group,
@ -407,7 +407,7 @@ nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
if (!alphaColormap)
return false;
GdkPixmap* pixmap = gdk_pixmap_new(NULL, dragRect.width, dragRect.height,
GdkPixmap* pixmap = gdk_pixmap_new(nullptr, dragRect.width, dragRect.height,
gdk_colormap_get_visual(alphaColormap)->depth);
if (!pixmap)
return false;
@ -433,7 +433,7 @@ nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
xPixmapCtx->Paint(DRAG_IMAGE_ALPHA_LEVEL);
// The drag transaction addrefs the pixmap, so we can just unref it from us here
gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, NULL,
gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, nullptr,
aXOffset, aYOffset);
g_object_unref(pixmap);
return true;
@ -460,7 +460,7 @@ nsDragService::EndDragSession(bool aDoneDrag)
g_signal_handlers_disconnect_by_func(sGrabWidget,
FuncToGpointer(OnSourceGrabEventAfter), this);
g_object_unref(sGrabWidget);
sGrabWidget = NULL;
sGrabWidget = nullptr;
if (sMotionEventTimerID) {
g_source_remove(sMotionEventTimerID);
@ -468,7 +468,7 @@ nsDragService::EndDragSession(bool aDoneDrag)
}
if (sMotionEvent) {
gdk_event_free(sMotionEvent);
sMotionEvent = NULL;
sMotionEvent = nullptr;
}
}
@ -980,7 +980,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
tmp; tmp = tmp->next) {
/* Bug 331198 */
GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
gchar *name = NULL;
gchar *name = nullptr;
name = gdk_atom_name(atom);
PR_LOG(sDragLm, PR_LOG_DEBUG,
("checking %s against %s\n", name, aDataFlavor));
@ -1081,11 +1081,11 @@ nsDragService::IsTargetContextList(void)
{
bool retval = false;
// gMimeListType drags only work for drags within a single process.
// The gtk_drag_get_source_widget() function will return NULL if the
// source of the drag is another app, so we use it to check if a
// gMimeListType drop will work or not.
if (gtk_drag_get_source_widget(mTargetDragContext) == NULL)
// gMimeListType drags only work for drags within a single process. The
// gtk_drag_get_source_widget() function will return nullptr if the source
// of the drag is another app, so we use it to check if a gMimeListType
// drop will work or not.
if (gtk_drag_get_source_widget(mTargetDragContext) == nullptr)
return retval;
GList *tmp;
@ -1096,7 +1096,7 @@ nsDragService::IsTargetContextList(void)
tmp; tmp = tmp->next) {
/* Bug 331198 */
GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
gchar *name = NULL;
gchar *name = nullptr;
name = gdk_atom_name(atom);
if (name && strcmp(name, gMimeListType) == 0)
retval = true;
@ -1147,7 +1147,7 @@ GtkTargetList *
nsDragService::GetSourceList(void)
{
if (!mSourceDataItems)
return NULL;
return nullptr;
nsTArray<GtkTargetEntry*> targetArray;
GtkTargetEntry *targets;
GtkTargetList *targetList = 0;
@ -1326,7 +1326,7 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext,
gint x, y;
GdkDisplay* display = gdk_display_get_default();
if (display) {
gdk_display_get_pointer(display, NULL, &x, &y, NULL);
gdk_display_get_pointer(display, nullptr, &x, &y, nullptr);
SetDragEndPoint(nsIntPoint(x, y));
}
}
@ -1341,7 +1341,8 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext,
// With GTK+ versions 2.10.x and prior the drag may have been
// cancelled (but no drag-failed signal would have been sent).
// aContext->dest_window will be non-NULL only if the drop was sent.
// aContext->dest_window will be non-nullptr only if the drop was
// sent.
GdkDragAction action =
gdk_drag_context_get_dest_window(aContext) ?
gdk_drag_context_get_actions(aContext) : (GdkDragAction)0;
@ -1374,14 +1375,14 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext,
}
// Schedule the appropriate drag end dom events.
Schedule(eDragTaskSourceEnd, nullptr, NULL, nsIntPoint(), 0);
Schedule(eDragTaskSourceEnd, nullptr, nullptr, nsIntPoint(), 0);
}
static void
CreateUriList(nsISupportsArray *items, gchar **text, gint *length)
{
uint32_t i, count;
GString *uriList = g_string_new(NULL);
GString *uriList = g_string_new(nullptr);
items->Count(&count);
for (i = 0; i < count; i++) {
@ -1392,7 +1393,7 @@ CreateUriList(nsISupportsArray *items, gchar **text, gint *length)
if (item) {
uint32_t tmpDataLen = 0;
void *tmpData = NULL;
void *tmpData = nullptr;
nsresult rv = NS_OK;
nsCOMPtr<nsISupports> data;
rv = item->GetTransferData(kURLMime,
@ -1498,7 +1499,7 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
actualFlavor = mimeFlavor;
uint32_t tmpDataLen = 0;
void *tmpData = NULL;
void *tmpData = nullptr;
nsresult rv;
nsCOMPtr<nsISupports> data;
rv = item->GetTransferData(actualFlavor,
@ -1727,7 +1728,7 @@ nsDragService::ScheduleLeaveEvent()
// We don't know at this stage whether a drop signal will immediately
// follow. If the drop signal gets sent it will happen before we return
// to the main loop and the scheduled leave task will be replaced.
if (!Schedule(eDragTaskLeave, nullptr, NULL, nsIntPoint(), 0)) {
if (!Schedule(eDragTaskLeave, nullptr, nullptr, nsIntPoint(), 0)) {
NS_WARNING("Drag leave after drop");
}
}
@ -1780,8 +1781,8 @@ nsDragService::Schedule(DragTask aTask, nsWindow *aWindow,
// that a leave or drop is waiting, but managing different priorities
// may not be worth the effort. Motion tasks shouldn't queue up as
// they should be throttled based on replies.
mTaskSource =
g_idle_add_full(G_PRIORITY_HIGH, TaskDispatchCallback, this, NULL);
mTaskSource = g_idle_add_full(G_PRIORITY_HIGH, TaskDispatchCallback,
this, nullptr);
}
return TRUE;
}
@ -1841,7 +1842,7 @@ nsDragService::RunScheduledTask()
// This may be the start of a destination drag session.
StartDragSession();
// mTargetWidget may be NULL if the window has been destroyed.
// mTargetWidget may be nullptr if the window has been destroyed.
// (The leave event is not scheduled if a drop task is still scheduled.)
// We still reply appropriately to indicate that the drop will or didn't
// succeeed.
@ -1900,8 +1901,8 @@ nsDragService::RunScheduledTask()
}
// We're done with the drag context.
mTargetWidget = NULL;
mTargetDragContext = NULL;
mTargetWidget = nullptr;
mTargetDragContext = nullptr;
// If we got another drag signal while running the sheduled task, that
// must have happened while running a nested event loop. Leave the task

View File

@ -136,7 +136,7 @@ private:
// mPendingWindow, mPendingWindowPoint, mPendingDragContext, and
// mPendingTime, carry information from the GTK signal that will be used
// when the scheduled task is run. mPendingWindow and mPendingDragContext
// will be NULL if the scheduled task is eDragTaskLeave.
// will be nullptr if the scheduled task is eDragTaskLeave.
nsRefPtr<nsWindow> mPendingWindow;
nsIntPoint mPendingWindowPoint;
nsCountedRef<GdkDragContext> mPendingDragContext;

View File

@ -92,10 +92,11 @@ UpdateFilePreviewWidget(GtkFileChooser *file_chooser,
if (preview_width > MAX_PREVIEW_SIZE || preview_height > MAX_PREVIEW_SIZE) {
preview_pixbuf = gdk_pixbuf_new_from_file_at_size(image_filename,
MAX_PREVIEW_SIZE,
MAX_PREVIEW_SIZE, NULL);
MAX_PREVIEW_SIZE,
nullptr);
}
else {
preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, NULL);
preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, nullptr);
}
g_free(image_filename);
@ -367,7 +368,7 @@ nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
gtk_file_chooser_dialog_new(title, parent_widget, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
accept_button, GTK_RESPONSE_ACCEPT,
NULL);
nullptr);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser),
GTK_RESPONSE_ACCEPT,
GTK_RESPONSE_CANCEL,
@ -435,7 +436,7 @@ nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
}
GtkFileFilter *filter = gtk_file_filter_new();
for (int j = 0; patterns[j] != NULL; ++j) {
for (int j = 0; patterns[j] != nullptr; ++j) {
nsAutoCString caseInsensitiveFilter = MakeCaseInsensitiveShellGlob(g_strstrip(patterns[j]));
gtk_file_filter_add_pattern(filter, caseInsensitiveFilter.get());
}

View File

@ -399,7 +399,7 @@ static const nsGtkCursor GtkCursors[] = {
{ moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4, "048008013003cff3c00c801001200000" },
{ moz_nesw_resize_bits, moz_nesw_resize_mask_bits, 8, 8, "50585d75b494802d0151028115016902" },
{ moz_nwse_resize_bits, moz_nwse_resize_mask_bits, 8, 8, "38c5dff7c7b8962045400281044508d2" },
{ moz_none_bits, moz_none_mask_bits, 0, 0, NULL }
{ moz_none_bits, moz_none_mask_bits, 0, 0, nullptr }
};
#endif /* nsGtkCursors_h__ */

View File

@ -212,7 +212,7 @@ nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext)
#if (MOZ_WIDGET_GTK == 2)
GtkIMContext *slave = multicontext->slave;
#else
GtkIMContext *slave = NULL; //TODO GTK3
GtkIMContext *slave = nullptr; //TODO GTK3
#endif
if (!slave) {
return;
@ -221,7 +221,7 @@ nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext)
GType slaveType = G_TYPE_FROM_INSTANCE(slave);
const gchar *im_type_name = g_type_name(slaveType);
if (strcmp(im_type_name, "GtkIMContextXIM") == 0) {
if (gtk_check_version(2, 12, 1) == NULL) {
if (gtk_check_version(2, 12, 1) == nullptr) {
return; // gtk bug has been fixed
}
@ -240,7 +240,7 @@ nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext)
g_signal_handlers_disconnect_matched(
gtk_widget_get_display(GTK_WIDGET(container)),
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, signal_data);
G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, signal_data);
// Add a reference to prevent the XIM module from being unloaded
// and reloaded: each time the module is loaded and used, it
@ -1201,7 +1201,7 @@ nsGtkIMModule::SetTextRangeList(nsTArray<TextRange> &aTextRangeList)
} else {
glong uniStrLen;
uniStr = g_utf8_to_utf16(preedit_string, start,
NULL, &uniStrLen, NULL);
nullptr, &uniStrLen, nullptr);
if (uniStr) {
range.mStartOffset = uniStrLen;
g_free(uniStr);
@ -1211,7 +1211,7 @@ nsGtkIMModule::SetTextRangeList(nsTArray<TextRange> &aTextRangeList)
glong uniStrLen;
uniStr = g_utf8_to_utf16(preedit_string + start, end - start,
NULL, &uniStrLen, NULL);
nullptr, &uniStrLen, nullptr);
if (!uniStr) {
range.mEndOffset = range.mStartOffset;
} else {

View File

@ -463,7 +463,7 @@ KeymapWrapper::GetCurrentModifierState()
{
GdkModifierType modifiers;
gdk_display_get_pointer(gdk_display_get_default(),
NULL, NULL, NULL, &modifiers);
nullptr, nullptr, nullptr, &modifiers);
return static_cast<guint>(modifiers);
}
@ -935,7 +935,7 @@ KeymapWrapper::GetCharCodeFor(const GdkEventKey *aGdkKeyEvent,
if (!gdk_keymap_translate_keyboard_state(mGdkKeymap,
aGdkKeyEvent->hardware_keycode,
GdkModifierType(aModifierState),
aGroup, &keyval, NULL, NULL, NULL)) {
aGroup, &keyval, nullptr, nullptr, nullptr)) {
return 0;
}
GdkEventKey tmpEvent = *aGdkKeyEvent;
@ -953,7 +953,7 @@ KeymapWrapper::GetKeyLevel(GdkEventKey *aGdkKeyEvent)
if (!gdk_keymap_translate_keyboard_state(mGdkKeymap,
aGdkKeyEvent->hardware_keycode,
GdkModifierType(aGdkKeyEvent->state),
aGdkKeyEvent->group, NULL, NULL, &level, NULL)) {
aGdkKeyEvent->group, nullptr, nullptr, &level, nullptr)) {
return -1;
}
return level;
@ -1019,7 +1019,7 @@ KeymapWrapper::GetGDKKeyvalWithoutModifier(const GdkEventKey *aGdkKeyEvent)
guint keyval;
if (!gdk_keymap_translate_keyboard_state(keymapWrapper->mGdkKeymap,
aGdkKeyEvent->hardware_keycode, GdkModifierType(state),
aGdkKeyEvent->group, &keyval, NULL, NULL, NULL)) {
aGdkKeyEvent->group, &keyval, nullptr, nullptr, nullptr)) {
return 0;
}
return keyval;

View File

@ -159,7 +159,7 @@ protected:
/**
* GetModifierKey() returns modifier key information of the hardware
* keycode. If the key isn't a modifier key, returns NULL.
* keycode. If the key isn't a modifier key, returns nullptr.
*/
ModifierKey* GetModifierKey(guint aHardwareKeycode);
@ -221,7 +221,7 @@ protected:
* GetCharCodeFor() Computes what character is inputted by the key event
* with aModifierState and aGroup.
*
* @param aGdkKeyEvent Native key event, must not be NULL.
* @param aGdkKeyEvent Native key event, must not be nullptr.
* @param aModifierState Combination of GdkModifierType which you
* want to test with aGdkKeyEvent.
* @param aGroup Set group in the mGdkKeymap.
@ -236,7 +236,7 @@ protected:
/**
* GetKeyLevel() returns level of the aGdkKeyEvent in mGdkKeymap.
*
* @param aGdkKeyEvent Native key event, must not be NULL.
* @param aGdkKeyEvent Native key event, must not be nullptr.
* @return Using level. Typically, this is 0 or 1.
* If failed, this returns -1.
*/
@ -287,7 +287,7 @@ protected:
* InitKeypressEvent() intializes keyCode, charCode and
* alternativeCharCodes of keypress event.
*
* @param aKeyEvent An NS_KEY_PRESS event, must not be NULL.
* @param aKeyEvent An NS_KEY_PRESS event, must not be nullptr.
* The modifier related members and keyCode must
* be initialized already.
* @param aGdkKeyEvent A native key event which causes dispatching

View File

@ -466,7 +466,7 @@ static void darken_gdk_color(GdkColor *src, GdkColor *dest)
static int32_t CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, int32_t aResult) {
gboolean value = FALSE;
gtk_widget_style_get(aWidget, aStyle, &value, NULL);
gtk_widget_style_get(aWidget, aStyle, &value, nullptr);
return value ? aResult : 0;
}
@ -522,7 +522,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
g_object_get (settings,
"gtk-cursor-blink-time", &blink_time,
"gtk-cursor-blink", &blink,
NULL);
nullptr);
if (blink)
aResult = (int32_t) blink_time;
@ -548,7 +548,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
g_object_get(settings,
"gtk-entry-select-on-focus",
&select_on_focus,
NULL);
nullptr);
if(select_on_focus)
aResult = 1;
@ -565,7 +565,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
gint delay;
settings = gtk_settings_get_default ();
g_object_get (settings, "gtk-menu-popup-delay", &delay, NULL);
g_object_get (settings, "gtk-menu-popup-delay", &delay, nullptr);
aResult = (int32_t) delay;
break;
}
@ -588,7 +588,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
gint threshold = 0;
g_object_get(gtk_widget_get_settings(box),
"gtk-dnd-drag-threshold", &threshold,
NULL);
nullptr);
g_object_ref_sink(box);
aResult = threshold;
@ -708,7 +708,7 @@ GetSystemFontInfo(GtkWidget *aWidget,
aFontStyle->style = NS_FONT_STYLE_NORMAL;
gchar *fontname;
g_object_get(settings, "gtk-font-name", &fontname, NULL);
g_object_get(settings, "gtk-font-name", &fontname, nullptr);
PangoFontDescription *desc;
desc = pango_font_description_from_string(fontname);
@ -824,9 +824,9 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
gfxFontStyle& aFontStyle,
float aDevPixPerCSSPixel)
{
nsString *cachedFontName = NULL;
gfxFontStyle *cachedFontStyle = NULL;
bool *isCached = NULL;
nsString *cachedFontName = nullptr;
gfxFontStyle *cachedFontStyle = nullptr;
bool *isCached = nullptr;
switch (aID) {
case eFont_Menu: // css2
@ -938,8 +938,8 @@ nsLookAndFeel::Init()
gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_set_style(accel_label, NULL);
gtk_widget_set_style(menu, NULL);
gtk_widget_set_style(accel_label, nullptr);
gtk_widget_set_style(menu, nullptr);
gtk_widget_realize(menu);
gtk_widget_realize(accel_label);
@ -1064,14 +1064,14 @@ nsLookAndFeel::Init()
gtk_container_add(GTK_CONTAINER(parent), entry);
#if (MOZ_WIDGET_GTK == 2)
gtk_widget_set_style(button, NULL);
gtk_widget_set_style(label, NULL);
gtk_widget_set_style(treeView, NULL);
gtk_widget_set_style(linkButton, NULL);
gtk_widget_set_style(combobox, NULL);
gtk_widget_set_style(comboboxLabel, NULL);
gtk_widget_set_style(menuBar, NULL);
gtk_widget_set_style(entry, NULL);
gtk_widget_set_style(button, nullptr);
gtk_widget_set_style(label, nullptr);
gtk_widget_set_style(treeView, nullptr);
gtk_widget_set_style(linkButton, nullptr);
gtk_widget_set_style(combobox, nullptr);
gtk_widget_set_style(comboboxLabel, nullptr);
gtk_widget_set_style(menuBar, nullptr);
gtk_widget_set_style(entry, nullptr);
gtk_widget_realize(button);
gtk_widget_realize(label);
@ -1108,17 +1108,17 @@ nsLookAndFeel::Init()
// slightly by a hardcoded value (gtkstyle.c)
// 3) If neither are defined, take the base background color and
// darken that by a hardcoded value
colorValuePtr = NULL;
colorValuePtr = nullptr;
gtk_widget_style_get(treeView,
"odd-row-color", &colorValuePtr,
NULL);
nullptr);
if (colorValuePtr) {
colorValue = *colorValuePtr;
} else {
gtk_widget_style_get(treeView,
"even-row-color", &colorValuePtr,
NULL);
nullptr);
if (colorValuePtr)
darken_gdk_color(colorValuePtr, &colorValue);
else
@ -1192,13 +1192,13 @@ nsLookAndFeel::Init()
if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) {
gtk_widget_style_get(menuBar,
"window-dragging", &supports_menubar_drag,
NULL);
nullptr);
}
}
sMenuSupportsDrag = supports_menubar_drag;
colorValuePtr = NULL;
gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, NULL);
colorValuePtr = nullptr;
gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, nullptr);
if (colorValuePtr) {
colorValue = *colorValuePtr; // we can't pass deref pointers to GDK_COLOR_TO_NS_RGB
sNativeHyperLinkText = GDK_COLOR_TO_NS_RGB(colorValue);
@ -1209,13 +1209,13 @@ nsLookAndFeel::Init()
// invisible character styles
guint value;
g_object_get (entry, "invisible-char", &value, NULL);
g_object_get (entry, "invisible-char", &value, nullptr);
sInvisibleCharacter = PRUnichar(value);
// caret styles
gtk_widget_style_get(entry,
"cursor-aspect-ratio", &sCaretRatio,
NULL);
nullptr);
gtk_widget_destroy(window);
}

View File

@ -65,7 +65,7 @@ nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& aList)
for (int i = 0; i < num_dests; i++) {
nsAutoCString fullName(NS_CUPS_PRINTER);
fullName.Append(dests[i].name);
if (dests[i].instance != NULL) {
if (dests[i].instance != nullptr) {
fullName.Append("/");
fullName.Append(dests[i].instance);
}

View File

@ -69,7 +69,7 @@ ShowCustomDialog(GtkComboBox *changed_box, gpointer user_data)
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
nullptr);
gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog),
GTK_RESPONSE_ACCEPT,
@ -186,7 +186,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
int16_t frameUIFlag;
aSettings->GetHowToEnableFrameUI(&frameUIFlag);
radio_as_laid_out = gtk_radio_button_new_with_mnemonic(NULL, GetUTF8FromBundle("asLaidOut").get());
radio_as_laid_out = gtk_radio_button_new_with_mnemonic(nullptr, GetUTF8FromBundle("asLaidOut").get());
if (frameUIFlag == nsIPrintSettings::kFrameEnableNone)
gtk_widget_set_sensitive(radio_as_laid_out, FALSE);
@ -202,7 +202,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
gtk_widget_set_sensitive(radio_separate_frames, FALSE);
// "Print Frames" options label, bold and center-aligned
GtkWidget* print_frames_label = gtk_label_new(NULL);
GtkWidget* print_frames_label = gtk_label_new(nullptr);
char* pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printFramesTitleGTK").get());
gtk_label_set_markup(GTK_LABEL(print_frames_label), pangoMarkup);
g_free(pangoMarkup);
@ -235,7 +235,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
"support-selection", TRUE,
"has-selection", canSelectText,
"embed-page-setup", TRUE,
NULL);
nullptr);
} else {
useNativeSelection = false;
selection_only_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("selectionOnly").get());
@ -251,7 +251,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
gtk_box_pack_start(GTK_BOX(appearance_buttons_container), print_bg_images_toggle, FALSE, FALSE, 0);
// "Appearance" options label, bold and center-aligned
GtkWidget* appearance_label = gtk_label_new(NULL);
GtkWidget* appearance_label = gtk_label_new(nullptr);
pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printBGOptions").get());
gtk_label_set_markup(GTK_LABEL(appearance_label), pangoMarkup);
g_free(pangoMarkup);
@ -266,7 +266,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
gtk_box_pack_start(GTK_BOX(appearance_vertical_squasher), appearance_container, FALSE, FALSE, 0);
// "Header & Footer" options label, bold and center-aligned
GtkWidget* header_footer_label = gtk_label_new(NULL);
GtkWidget* header_footer_label = gtk_label_new(nullptr);
pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("headerFooter").get());
gtk_label_set_markup(GTK_LABEL(header_footer_label), pangoMarkup);
g_free(pangoMarkup);
@ -485,7 +485,7 @@ nsPrintDialogWidgetGTK::ConstructHeaderFooterDropdown(const PRUnichar *currentSt
#if (MOZ_WIDGET_GTK == 2)
gtk_combo_box_append_text(GTK_COMBO_BOX(dropdown), GetUTF8FromBundle(hf_options[i]).get());
#else
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), NULL,
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), nullptr,
GetUTF8FromBundle(hf_options[i]).get());
#endif
}

View File

@ -43,9 +43,9 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsGTK,
/** ---------------------------------------------------
*/
nsPrintSettingsGTK::nsPrintSettingsGTK() :
mPageSetup(NULL),
mPrintSettings(NULL),
mGTKPrinter(NULL),
mPageSetup(nullptr),
mPrintSettings(nullptr),
mGTKPrinter(nullptr),
mPrintSelectionOnly(false)
{
// The aim here is to set up the objects enough that silent printing works well.
@ -56,7 +56,7 @@ nsPrintSettingsGTK::nsPrintSettingsGTK() :
SetOutputFormat(nsIPrintSettings::kOutputFormatNative);
GtkPaperSize* defaultPaperSize = gtk_paper_size_new(NULL);
GtkPaperSize* defaultPaperSize = gtk_paper_size_new(nullptr);
mPaperSize = moz_gtk_paper_size_copy_to_new_custom(defaultPaperSize);
gtk_paper_size_free(defaultPaperSize);
SaveNewPageSize();
@ -68,15 +68,15 @@ nsPrintSettingsGTK::~nsPrintSettingsGTK()
{
if (mPageSetup) {
g_object_unref(mPageSetup);
mPageSetup = NULL;
mPageSetup = nullptr;
}
if (mPrintSettings) {
g_object_unref(mPrintSettings);
mPrintSettings = NULL;
mPrintSettings = nullptr;
}
if (mGTKPrinter) {
g_object_unref(mGTKPrinter);
mGTKPrinter = NULL;
mGTKPrinter = nullptr;
}
gtk_paper_size_free(mPaperSize);
}
@ -84,9 +84,9 @@ nsPrintSettingsGTK::~nsPrintSettingsGTK()
/** ---------------------------------------------------
*/
nsPrintSettingsGTK::nsPrintSettingsGTK(const nsPrintSettingsGTK& aPS) :
mPageSetup(NULL),
mPrintSettings(NULL),
mGTKPrinter(NULL),
mPageSetup(nullptr),
mPrintSettings(nullptr),
mGTKPrinter(nullptr),
mPrintSelectionOnly(false)
{
*this = aPS;
@ -406,7 +406,8 @@ nsPrintSettingsGTK::SetToFileName(const PRUnichar * aToFileName)
{
if (aToFileName[0] == 0) {
mToFileName.SetLength(0);
gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI, NULL);
gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI,
nullptr);
return NS_OK;
}
@ -710,11 +711,11 @@ nsPrintSettingsGTK::SetupSilentPrinting()
// We have to get a printer here, rather than when the print settings are constructed.
// This is because when we request sync, GTK makes us wait in the *event loop* while waiting
// for the enumeration to finish. We must do this when event loop runs are expected.
gtk_enumerate_printers(printer_enumerator, this, NULL, TRUE);
gtk_enumerate_printers(printer_enumerator, this, nullptr, TRUE);
// XXX If no default printer set, get the first one.
if (!GTK_IS_PRINTER(mGTKPrinter))
gtk_enumerate_printers(ref_printer, this, NULL, TRUE);
gtk_enumerate_printers(ref_printer, this, nullptr, TRUE);
return NS_OK;
}

View File

@ -138,7 +138,7 @@ protected:
/**
* On construction:
* - mPrintSettings, mPageSetup and mPaperSize are just new objects with defaults determined by GTK.
* - mGTKPrinter is NULL!!! Remember to be careful when accessing this property.
* - mGTKPrinter is nullptr!!! Remember to be careful when accessing this property.
*/
GtkPageSetup* mPageSetup;
GtkPrintSettings* mPrintSettings;

View File

@ -111,7 +111,7 @@ nsresult
nsScreenManagerGtk :: Init()
{
#ifdef MOZ_X11
XineramaScreenInfo *screenInfo = NULL;
XineramaScreenInfo *screenInfo = nullptr;
int numScreens;
if (!mXineramalib) {
@ -134,7 +134,7 @@ nsScreenManagerGtk :: Init()
}
}
// screenInfo == NULL if either Xinerama couldn't be loaded or
// screenInfo == nullptr if either Xinerama couldn't be loaded or
// isn't running on the current display
if (!screenInfo || numScreens == 1) {
numScreens = 1;

View File

@ -110,10 +110,12 @@ ca_context_get_default()
if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings),
"gtk-sound-theme-name")) {
gchar* sound_theme_name = nullptr;
g_object_get(settings, "gtk-sound-theme-name", &sound_theme_name, NULL);
g_object_get(settings, "gtk-sound-theme-name", &sound_theme_name,
nullptr);
if (sound_theme_name) {
ca_context_change_props(ctx, "canberra.xdg-theme.name", sound_theme_name, NULL);
ca_context_change_props(ctx, "canberra.xdg-theme.name",
sound_theme_name, nullptr);
g_free(sound_theme_name);
}
}
@ -130,7 +132,8 @@ ca_context_get_default()
getter_Copies(wbrand));
NS_ConvertUTF16toUTF8 brand(wbrand);
ca_context_change_props(ctx, "application.name", brand.get(), NULL);
ca_context_change_props(ctx, "application.name", brand.get(),
nullptr);
}
}
@ -139,10 +142,12 @@ ca_context_get_default()
nsAutoCString version;
appInfo->GetVersion(version);
ca_context_change_props(ctx, "application.version", version.get(), NULL);
ca_context_change_props(ctx, "application.version", version.get(),
nullptr);
}
ca_context_change_props(ctx, "application.icon_name", MOZ_APP_NAME, NULL);
ca_context_change_props(ctx, "application.icon_name", MOZ_APP_NAME,
nullptr);
return ctx;
}
@ -331,12 +336,12 @@ NS_METHOD nsSound::Play(nsIURL *aURL)
if (NS_FAILED(rv)) {
return rv;
}
gchar *path = g_filename_from_uri(spec.get(), NULL, NULL);
gchar *path = g_filename_from_uri(spec.get(), nullptr, nullptr);
if (!path) {
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
}
ca_context_play(ctx, 0, "media.filename", path, NULL);
ca_context_play(ctx, 0, "media.filename", path, nullptr);
g_free(path);
} else {
nsCOMPtr<nsIStreamLoader> loader;
@ -360,7 +365,7 @@ NS_IMETHODIMP nsSound::PlayEventSound(uint32_t aEventId)
if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings),
"gtk-enable-event-sounds")) {
gboolean enable_sounds = TRUE;
g_object_get(settings, "gtk-enable-event-sounds", &enable_sounds, NULL);
g_object_get(settings, "gtk-enable-event-sounds", &enable_sounds, nullptr);
if (!enable_sounds) {
return NS_OK;
@ -374,19 +379,19 @@ NS_IMETHODIMP nsSound::PlayEventSound(uint32_t aEventId)
switch (aEventId) {
case EVENT_ALERT_DIALOG_OPEN:
ca_context_play(ctx, 0, "event.id", "dialog-warning", NULL);
ca_context_play(ctx, 0, "event.id", "dialog-warning", nullptr);
break;
case EVENT_CONFIRM_DIALOG_OPEN:
ca_context_play(ctx, 0, "event.id", "dialog-question", NULL);
ca_context_play(ctx, 0, "event.id", "dialog-question", nullptr);
break;
case EVENT_NEW_MAIL_RECEIVED:
ca_context_play(ctx, 0, "event.id", "message-new-email", NULL);
ca_context_play(ctx, 0, "event.id", "message-new-email", nullptr);
break;
case EVENT_MENU_EXECUTE:
ca_context_play(ctx, 0, "event.id", "menu-click", NULL);
ca_context_play(ctx, 0, "event.id", "menu-click", nullptr);
break;
case EVENT_MENU_POPUP:
ca_context_play(ctx, 0, "event.id", "menu-popup", NULL);
ca_context_play(ctx, 0, "event.id", "menu-popup", nullptr);
break;
}
return NS_OK;

View File

@ -92,14 +92,14 @@ nsNativeThemeGTKConstructor(nsISupports *aOuter, REFNSIID aIID,
if (gDisableNativeTheme)
return NS_ERROR_NO_INTERFACE;
*aResult = NULL;
if (NULL != aOuter) {
*aResult = nullptr;
if (nullptr != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
inst = new nsNativeThemeGTK();
if (NULL == inst) {
if (nullptr == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
@ -181,14 +181,14 @@ nsNativeKeyBindingsConstructor(nsISupports *aOuter, REFNSIID aIID,
nsNativeKeyBindings *inst;
*aResult = NULL;
if (NULL != aOuter) {
*aResult = nullptr;
if (nullptr != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
inst = new nsNativeKeyBindings();
if (NULL == inst) {
if (nullptr == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
@ -252,40 +252,40 @@ NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_WINDOW_CID, false, NULL, nsWindowConstructor },
{ &kNS_CHILD_CID, false, NULL, nsChildWindowConstructor },
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor },
{ &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor },
{ &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor },
{ &kNS_SOUND_CID, false, NULL, nsSoundConstructor },
{ &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
{ &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
{ &kNS_CHILD_CID, false, nullptr, nsChildWindowConstructor },
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
{ &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor },
{ &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor },
{ &kNS_SOUND_CID, false, nullptr, nsSoundConstructor },
{ &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
#ifdef MOZ_X11
{ &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor },
{ &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor },
{ &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor },
{ &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
{ &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor },
#endif
{ &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor },
{ &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor },
{ &kNS_NATIVEKEYBINDINGSINPUT_CID, false, NULL, nsNativeKeyBindingsInputConstructor },
{ &kNS_NATIVEKEYBINDINGSTEXTAREA_CID, false, NULL, nsNativeKeyBindingsTextAreaConstructor },
{ &kNS_NATIVEKEYBINDINGSEDITOR_CID, false, NULL, nsNativeKeyBindingsTextAreaConstructor },
{ &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerGtkConstructor },
{ &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
{ &kNS_NATIVEKEYBINDINGSINPUT_CID, false, nullptr, nsNativeKeyBindingsInputConstructor },
{ &kNS_NATIVEKEYBINDINGSTEXTAREA_CID, false, nullptr, nsNativeKeyBindingsTextAreaConstructor },
{ &kNS_NATIVEKEYBINDINGSEDITOR_CID, false, nullptr, nsNativeKeyBindingsTextAreaConstructor },
{ &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerGtkConstructor },
#ifdef NATIVE_THEME_SUPPORT
{ &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeGTKConstructor },
{ &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeGTKConstructor },
#endif
#ifdef NS_PRINTING
{ &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsGTKConstructor },
{ &kNS_PRINTER_ENUMERATOR_CID, false, NULL, nsPrinterEnumeratorGTKConstructor },
{ &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor },
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecGTKConstructor },
{ &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceGTKConstructor },
{ &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsGTKConstructor },
{ &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorGTKConstructor },
{ &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecGTKConstructor },
{ &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceGTKConstructor },
#endif
{ &kNS_IMAGE_TO_PIXBUF_CID, false, NULL, nsImageToPixbufConstructor },
{ &kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor },
#if defined(MOZ_X11)
{ &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGTKConstructor },
{ &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor },
{ &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor },
{ &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
#endif
{ NULL }
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
@ -322,7 +322,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
{ "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
#endif
{ NULL }
{ nullptr }
};
static void
@ -340,8 +340,8 @@ static const mozilla::Module kWidgetModule = {
mozilla::Module::kVersion,
kWidgetCIDs,
kWidgetContracts,
NULL,
NULL,
nullptr,
nullptr,
nsAppShellInit,
nsWidgetGtk2ModuleDtor
};

View File

@ -257,11 +257,11 @@ static guint32 sRetryGrabTime;
static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID);
// The window from which the focus manager asks us to dispatch key events.
static nsWindow *gFocusWindow = NULL;
static nsWindow *gFocusWindow = nullptr;
static bool gBlockActivateEvent = false;
static bool gGlobalsInitialized = false;
static bool gRaiseWindows = true;
static nsWindow *gPluginFocusWindow = NULL;
static nsWindow *gPluginFocusWindow = nullptr;
#define NS_WINDOW_TITLE_MAX_LENGTH 4095
@ -278,7 +278,7 @@ typedef struct _GdkDisplay GdkDisplay;
// cursor cache
static GdkCursor *gCursorCache[eCursorCount];
static GtkWidget *gInvisibleContainer = NULL;
static GtkWidget *gInvisibleContainer = nullptr;
// Sometimes this actually also includes the state of the modifier keys, but
// only the button state bits are used.
@ -527,7 +527,7 @@ CheckDestroyInvisibleContainer()
// No children, so not in use.
// Make sure to destroy the GtkWindow also.
gtk_widget_destroy(gtk_widget_get_parent(gInvisibleContainer));
gInvisibleContainer = NULL;
gInvisibleContainer = nullptr;
}
}
@ -687,8 +687,8 @@ nsWindow::Destroy(void)
// MozContainer widget is destroyed.)
DestroyChildWindows();
gdk_window_set_user_data(mGdkWindow, NULL);
g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
gdk_window_set_user_data(mGdkWindow, nullptr);
g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", nullptr);
gdk_window_destroy(mGdkWindow);
mGdkWindow = nullptr;
}
@ -756,7 +756,7 @@ nsWindow::SetParent(nsIWidget *aNewParent)
aNewParent->AddChild(this);
ReparentNativeWidget(aNewParent);
} else {
// aNewParent is NULL, but reparent to a hidden window to avoid
// aNewParent is nullptr, but reparent to a hidden window to avoid
// destroying the GdkWindow and its descendants.
// An invisible container widget is needed to hold descendant
// GtkWidgets.
@ -1532,7 +1532,7 @@ nsWindow::SetCursor(nsCursor aCursor)
// Only change cursor if it's actually been changed
if (aCursor != mCursor) {
GdkCursor *newCursor = NULL;
GdkCursor *newCursor = nullptr;
newCursor = get_gtk_cursor(aCursor);
@ -1733,8 +1733,8 @@ nsWindow::SetIcon(const nsAString& aIconSpec)
ResolveIconName(aIconSpec, extension, getter_AddRefs(iconFile));
if (iconFile) {
iconFile->GetNativePath(path);
GdkPixbuf *icon = gdk_pixbuf_new_from_file(path.get(), NULL);
if (icon){
GdkPixbuf *icon = gdk_pixbuf_new_from_file(path.get(), nullptr);
if (icon) {
gtk_icon_theme_add_builtin_icon(iconName.get(),
gdk_pixbuf_get_height(icon),
icon);
@ -1912,9 +1912,9 @@ gdk_window_flash(GdkWindow * aGdkWindow,
GdkColor white;
#if (MOZ_WIDGET_GTK == 2)
gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height,NULL);
gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height,nullptr);
#else
gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height);
gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height);
#endif
gdk_window_get_origin (aGdkWindow,
@ -2333,7 +2333,7 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
NS_ASSERTION(GTK_IS_WINDOW(aWidget),
"Configure event on widget that is not a GtkWindow");
gint type;
g_object_get(aWidget, "type", &type, NULL);
g_object_get(aWidget, "type", &type, nullptr);
if (type == GTK_WINDOW_POPUP) {
// Override-redirect window
//
@ -2370,8 +2370,8 @@ nsWindow::OnContainerUnrealize()
if (mGdkWindow) {
DestroyChildWindows();
g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
mGdkWindow = NULL;
g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", nullptr);
mGdkWindow = nullptr;
}
}
@ -2423,7 +2423,7 @@ nsWindow::OnEnterNotifyEvent(GdkEventCrossing *aEvent)
// Gecko window then we'll catch the corresponding event on that window,
// but we won't notice when the pointer directly enters a foreign (plugin)
// child window without passing over a visible portion of a Gecko window.
if (aEvent->subwindow != NULL)
if (aEvent->subwindow != nullptr)
return;
// Check before is_parent_ungrab_enter() as the button state may have
@ -2472,7 +2472,7 @@ nsWindow::OnLeaveNotifyEvent(GdkEventCrossing *aEvent)
// XXXkt However, we will miss toplevel exits when the pointer directly
// leaves a foreign (plugin) child window without passing over a visible
// portion of a Gecko window.
if (aEvent->subwindow != NULL)
if (aEvent->subwindow != nullptr)
return;
WidgetMouseEvent event(true, NS_MOUSE_EXIT, this, WidgetMouseEvent::eReal);
@ -2826,7 +2826,7 @@ nsWindow::OnContainerFocusInEvent(GdkEventFocus *aEvent)
if (!gFocusWindow) {
// We don't really have a window for dispatching key events, but
// setting a non-NULL value here prevents OnButtonPressEvent() from
// setting a non-nullptr value here prevents OnButtonPressEvent() from
// dispatching an activation notification if the widget is already
// active.
gFocusWindow = this;
@ -3149,7 +3149,7 @@ nsWindow::OnVisibilityNotifyEvent(GdkEventVisibility *aEvent)
if (mIsFullyObscured && mHasMappedToplevel) {
// GDK_EXPOSE events have been ignored, so make sure GDK
// doesn't think that the window has already been painted.
gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
gdk_window_invalidate_rect(mGdkWindow, nullptr, FALSE);
}
mIsFullyObscured = false;
@ -3338,7 +3338,7 @@ CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
#if (MOZ_WIDGET_GTK == 2)
/* set the default pixmap to None so that you don't end up with the
gtk default which is BlackPixel. */
gdk_window_set_back_pixmap(window, NULL, FALSE);
gdk_window_set_back_pixmap(window, nullptr, FALSE);
#endif
return window;
@ -3500,7 +3500,7 @@ nsWindow::Create(nsIWidget *aParent,
// WM_TAKE_FOCUS, focus is requested on the parent window.
gtk_widget_realize(mShell);
gdk_window_add_filter(gtk_widget_get_window(mShell),
popup_take_focus_filter, NULL);
popup_take_focus_filter, nullptr);
#endif
}
@ -3619,11 +3619,11 @@ nsWindow::Create(nsIWidget *aParent,
// attach listeners for events
if (mShell) {
g_signal_connect(mShell, "configure_event",
G_CALLBACK(configure_event_cb), NULL);
G_CALLBACK(configure_event_cb), nullptr);
g_signal_connect(mShell, "delete_event",
G_CALLBACK(delete_event_cb), NULL);
G_CALLBACK(delete_event_cb), nullptr);
g_signal_connect(mShell, "window_state_event",
G_CALLBACK(window_state_event_cb), NULL);
G_CALLBACK(window_state_event_cb), nullptr);
GtkSettings* default_settings = gtk_settings_get_default();
g_signal_connect_after(default_settings,
@ -3637,45 +3637,45 @@ nsWindow::Create(nsIWidget *aParent,
if (mContainer) {
// Widget signals
g_signal_connect(mContainer, "unrealize",
G_CALLBACK(container_unrealize_cb), NULL);
G_CALLBACK(container_unrealize_cb), nullptr);
g_signal_connect_after(mContainer, "size_allocate",
G_CALLBACK(size_allocate_cb), NULL);
G_CALLBACK(size_allocate_cb), nullptr);
g_signal_connect(mContainer, "hierarchy-changed",
G_CALLBACK(hierarchy_changed_cb), NULL);
G_CALLBACK(hierarchy_changed_cb), nullptr);
// Initialize mHasMappedToplevel.
hierarchy_changed_cb(GTK_WIDGET(mContainer), NULL);
hierarchy_changed_cb(GTK_WIDGET(mContainer), nullptr);
// Expose, focus, key, and drag events are sent even to GTK_NO_WINDOW
// widgets.
#if (MOZ_WIDGET_GTK == 2)
g_signal_connect(mContainer, "expose_event",
G_CALLBACK(expose_event_cb), NULL);
G_CALLBACK(expose_event_cb), nullptr);
#else
g_signal_connect(G_OBJECT(mContainer), "draw",
G_CALLBACK(expose_event_cb), NULL);
G_CALLBACK(expose_event_cb), nullptr);
#endif
g_signal_connect(mContainer, "focus_in_event",
G_CALLBACK(focus_in_event_cb), NULL);
G_CALLBACK(focus_in_event_cb), nullptr);
g_signal_connect(mContainer, "focus_out_event",
G_CALLBACK(focus_out_event_cb), NULL);
G_CALLBACK(focus_out_event_cb), nullptr);
g_signal_connect(mContainer, "key_press_event",
G_CALLBACK(key_press_event_cb), NULL);
G_CALLBACK(key_press_event_cb), nullptr);
g_signal_connect(mContainer, "key_release_event",
G_CALLBACK(key_release_event_cb), NULL);
G_CALLBACK(key_release_event_cb), nullptr);
gtk_drag_dest_set((GtkWidget *)mContainer,
(GtkDestDefaults)0,
NULL,
nullptr,
0,
(GdkDragAction)0);
g_signal_connect(mContainer, "drag_motion",
G_CALLBACK(drag_motion_event_cb), NULL);
G_CALLBACK(drag_motion_event_cb), nullptr);
g_signal_connect(mContainer, "drag_leave",
G_CALLBACK(drag_leave_event_cb), NULL);
G_CALLBACK(drag_leave_event_cb), nullptr);
g_signal_connect(mContainer, "drag_drop",
G_CALLBACK(drag_drop_event_cb), NULL);
G_CALLBACK(drag_drop_event_cb), nullptr);
g_signal_connect(mContainer, "drag_data_received",
G_CALLBACK(drag_data_received_event_cb), NULL);
G_CALLBACK(drag_data_received_event_cb), nullptr);
GtkWidget *widgets[] = { GTK_WIDGET(mContainer), mShell };
for (size_t i = 0; i < ArrayLength(widgets) && widgets[i]; ++i) {
@ -3683,7 +3683,7 @@ nsWindow::Create(nsIWidget *aParent,
// window but do not propagate to parent widgets so connect on
// mShell (if it exists) as well as mContainer.
g_signal_connect(widgets[i], "visibility-notify-event",
G_CALLBACK(visibility_notify_event_cb), NULL);
G_CALLBACK(visibility_notify_event_cb), nullptr);
// Similarly double buffering is controlled by the window's owning
// widget. Disable double buffering for painting directly to the
// X Window.
@ -3713,17 +3713,17 @@ nsWindow::Create(nsIWidget *aParent,
// need only connect on mShell, if it exists, to catch events on its
// window and windows of mContainer.
g_signal_connect(eventWidget, "enter-notify-event",
G_CALLBACK(enter_notify_event_cb), NULL);
G_CALLBACK(enter_notify_event_cb), nullptr);
g_signal_connect(eventWidget, "leave-notify-event",
G_CALLBACK(leave_notify_event_cb), NULL);
G_CALLBACK(leave_notify_event_cb), nullptr);
g_signal_connect(eventWidget, "motion-notify-event",
G_CALLBACK(motion_notify_event_cb), NULL);
G_CALLBACK(motion_notify_event_cb), nullptr);
g_signal_connect(eventWidget, "button-press-event",
G_CALLBACK(button_press_event_cb), NULL);
G_CALLBACK(button_press_event_cb), nullptr);
g_signal_connect(eventWidget, "button-release-event",
G_CALLBACK(button_release_event_cb), NULL);
G_CALLBACK(button_release_event_cb), nullptr);
g_signal_connect(eventWidget, "scroll-event",
G_CALLBACK(scroll_event_cb), NULL);
G_CALLBACK(scroll_event_cb), nullptr);
}
LOG(("nsWindow [%p]\n", (void *)this));
@ -3760,7 +3760,7 @@ nsWindow::SetWindowClass(const nsAString &xulWinType)
if (!res_name)
return NS_ERROR_OUT_OF_MEMORY;
const char *role = NULL;
const char *role = nullptr;
// Parse res_name into a name and role. Characters other than
// [A-Za-z0-9_-] are converted to '_'. Anything after the first
@ -3919,7 +3919,7 @@ nsWindow::SetHasMappedToplevel(bool aState)
// GDK_EXPOSE events have been ignored but the window is now visible,
// so make sure GDK doesn't think that the window has already been
// painted.
gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
gdk_window_invalidate_rect(mGdkWindow, nullptr, FALSE);
// Check that a grab didn't fail due to the window not being
// viewable.
@ -4403,7 +4403,7 @@ nsWindow::GrabPointer(guint32 aTime)
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK),
(GdkWindow *)NULL, NULL, aTime);
(GdkWindow *)nullptr, nullptr, aTime);
if (retval == GDK_GRAB_NOT_VIEWABLE) {
LOG(("GrabPointer: window not viewable; will retry\n"));
@ -4444,7 +4444,7 @@ GtkWidget *
nsWindow::GetMozContainerWidget()
{
if (!mGdkWindow)
return NULL;
return nullptr;
if (mContainer)
return GTK_WIDGET(mContainer);
@ -4569,7 +4569,7 @@ nsWindow::SetNonXEmbedPluginFocus()
gdk_flush();
gdk_error_trap_pop();
gPluginFocusWindow = this;
gdk_window_add_filter(NULL, plugin_client_message_filter, this);
gdk_window_add_filter(nullptr, plugin_client_message_filter, this);
LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus oldfocus=%p new=%p\n",
mOldFocusWindow, gdk_x11_window_get_xid(mGdkWindow)));
@ -4610,9 +4610,9 @@ nsWindow::LoseNonXEmbedPluginFocus()
gdk_flush();
gdk_error_trap_pop();
}
gPluginFocusWindow = NULL;
gPluginFocusWindow = nullptr;
mOldFocusWindow = 0;
gdk_window_remove_filter(NULL, plugin_client_message_filter, this);
gdk_window_remove_filter(nullptr, plugin_client_message_filter, this);
LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus end\n"));
}
@ -4859,7 +4859,7 @@ get_window_for_gdk_window(GdkWindow *window)
static GtkWidget *
get_gtk_widget_for_gdk_window(GdkWindow *window)
{
gpointer user_data = NULL;
gpointer user_data = nullptr;
gdk_window_get_user_data(window, &user_data);
return GTK_WIDGET(user_data);
@ -4994,7 +4994,7 @@ get_gtk_cursor(nsCursor aCursor)
if (newType != 0xff && !gdkcursor) {
GdkPixbuf * cursor_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
if (!cursor_pixbuf)
return NULL;
return nullptr;
guchar *data = gdk_pixbuf_get_pixels(cursor_pixbuf);
@ -5535,7 +5535,7 @@ hierarchy_changed_cb (GtkWidget *widget,
if (event.changed_mask) {
event.type = GDK_WINDOW_STATE;
event.window = NULL;
event.window = nullptr;
event.send_event = TRUE;
window_state_event_cb(widget, &event);
}
@ -5716,7 +5716,7 @@ get_inner_gdk_window (GdkWindow *aWindow,
GdkWindow *childWindow = (GdkWindow *) child->data;
if (get_window_for_gdk_window(childWindow)) {
#if (MOZ_WIDGET_GTK == 2)
gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, NULL);
gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, nullptr);
#else
gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch);
#endif
@ -5936,7 +5936,7 @@ nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
} else {
// no visual? we must be using an xrender format. Find a format
// for this depth.
XRenderPictFormat *pf = NULL;
XRenderPictFormat *pf = nullptr;
switch (gdk_drawable_get_depth(aDrawable)) {
case 32:
pf = XRenderFindStandardFormat(xDisplay, PictStandardARGB32);
@ -5990,7 +5990,7 @@ nsWindow::GetThebesSurface(cairo_t *cr)
cairo_surface_t *surf = cairo_get_target(cr);
if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) {
NS_NOTREACHED("Missing cairo target?");
return NULL;
return nullptr;
}
#endif // MOZ_WIDGET_GTK2