From b5714d7a65a16c89c219d13b8ffa937ac8a5ac8a Mon Sep 17 00:00:00 2001 From: "enndeakin%sympatico.ca" Date: Wed, 16 May 2007 18:05:23 +0000 Subject: [PATCH] Bug 376238, add a pref to disable drag images, r=sr=roc --- modules/libpref/src/init/all.js | 3 +++ widget/src/xpwidgets/nsBaseDragService.cpp | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index a596f087e89..147b16e922e 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -197,6 +197,9 @@ pref("view_source.wrap_long_lines", false); // dispatch left clicks only to content in browser (still allows clicks to chrome/xul) pref("nglayout.events.dispatchLeftClickOnly", true); +// whether or not to draw images while dragging +pref("nglayout.enable_drag_images", true); + // whether or not to use xbl form controls pref("nglayout.debug.enable_xbl_forms", false); diff --git a/widget/src/xpwidgets/nsBaseDragService.cpp b/widget/src/xpwidgets/nsBaseDragService.cpp index e1180b790db..8a57b40621e 100644 --- a/widget/src/xpwidgets/nsBaseDragService.cpp +++ b/widget/src/xpwidgets/nsBaseDragService.cpp @@ -69,6 +69,7 @@ #include "nsIViewObserver.h" #include "nsRegion.h" #include "nsGUIEvent.h" +#include "nsIPrefService.h" #ifdef MOZ_CAIRO_GFX #include "gfxContext.h" @@ -76,6 +77,8 @@ #endif +#define DRAGIMAGES_PREF "nglayout.enable_drag_images" + NS_IMPL_ADDREF(nsBaseDragService) NS_IMPL_RELEASE(nsBaseDragService) NS_IMPL_QUERY_INTERFACE2(nsBaseDragService, nsIDragService, nsIDragSession) @@ -412,8 +415,14 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode, if (!presShell) return NS_ERROR_FAILURE; + // check if drag images are disabled + PRBool enableDragImages = PR_TRUE; + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) + prefs->GetBoolPref(DRAGIMAGES_PREF, &enableDragImages); + // didn't want an image, so just set the screen rectangle to the frame size - if (!mHasImage) { + if (!enableDragImages || !mHasImage) { // if a region was specified, set the screen rectangle to the area that // the region occupies if (aRegion) {