diff --git a/mozilla/widget/public/nsILookAndFeel.h b/mozilla/widget/public/nsILookAndFeel.h index 48114082ee7..c5abeb44687 100644 --- a/mozilla/widget/public/nsILookAndFeel.h +++ b/mozilla/widget/public/nsILookAndFeel.h @@ -66,7 +66,10 @@ public: eMetric_ListHorizontalInsideMinimumPadding, eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK - eMetric_ListVerticalInsidePadding // needed only because of GTK + eMetric_ListVerticalInsidePadding, // needed only because of GTK + + eMetric_CaretBlinkTime, // default, may be overriden by OS + eMetric_CaretWidthTwips } nsMetricID; typedef enum { diff --git a/mozilla/widget/src/beos/nsLookAndFeel.cpp b/mozilla/widget/src/beos/nsLookAndFeel.cpp index cc9fc381882..d9118097a48 100644 --- a/mozilla/widget/src/beos/nsLookAndFeel.cpp +++ b/mozilla/widget/src/beos/nsLookAndFeel.cpp @@ -139,6 +139,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_ListVerticalInsidePadding: aMetric = 0; break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; + break; default: aMetric = -1; res = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/gtk/nsLookAndFeel.cpp b/mozilla/widget/src/gtk/nsLookAndFeel.cpp index b355c82164e..a9be9abb5e1 100644 --- a/mozilla/widget/src/gtk/nsLookAndFeel.cpp +++ b/mozilla/widget/src/gtk/nsLookAndFeel.cpp @@ -153,6 +153,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_ListVerticalInsidePadding: aMetric = 1; break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; + break; default: aMetric = -1; res = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/mac/nsLookAndFeel.cpp b/mozilla/widget/src/mac/nsLookAndFeel.cpp index f9e8dfbaba9..a36c3233add 100644 --- a/mozilla/widget/src/mac/nsLookAndFeel.cpp +++ b/mozilla/widget/src/mac/nsLookAndFeel.cpp @@ -159,6 +159,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_ListVerticalInsidePadding: aMetric = 3; break; + case eMetric_CaretBlinkTime: + aMetric = ::GetCaretTime() * 1000 / 60; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; + break; default: aMetric = 0; res = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/motif/nsLookAndFeel.cpp b/mozilla/widget/src/motif/nsLookAndFeel.cpp index 87a32cb9ca4..e831894bbb9 100644 --- a/mozilla/widget/src/motif/nsLookAndFeel.cpp +++ b/mozilla/widget/src/motif/nsLookAndFeel.cpp @@ -110,6 +110,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_RadioboxSize: aMetric = 12; break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; + break; default: aMetric = 0; res = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/os2/nsLookAndFeel.cpp b/mozilla/widget/src/os2/nsLookAndFeel.cpp index 11b0e54d574..9e9cd59b59a 100644 --- a/mozilla/widget/src/os2/nsLookAndFeel.cpp +++ b/mozilla/widget/src/os2/nsLookAndFeel.cpp @@ -123,6 +123,28 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) aMetric = 0; break; + case eMetric_CaretBlinkTime: + aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE); + break; + case eMetric_CaretWidthTwips: + // Sigh - this is in 'twips', should be in 'app units', but there's no + // DC anyway so we can't work it out! + + // The reason for this is that there is some rounding weirdness, + // such that the 2-pixel caret requested by the windows guys + // got rounded down to a 1-pixel caret for drawing, because + // of errors in conversion to twips and back. + + ULONG ulPels = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER); + + // With luck, either: + // * these metrics will go into nsILookAndFeel, or + // * we'll get an nsIDeviceContext here + // + // For now, lets assume p2t = 20. + aMetric = 20 * ulPels; + break; + default: NS_ASSERTION( 0, "Bad metric"); break; diff --git a/mozilla/widget/src/photon/nsLookAndFeel.cpp b/mozilla/widget/src/photon/nsLookAndFeel.cpp index 0e1b8a77fbd..ce90052b685 100644 --- a/mozilla/widget/src/photon/nsLookAndFeel.cpp +++ b/mozilla/widget/src/photon/nsLookAndFeel.cpp @@ -158,6 +158,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) break; case eMetric_ListVerticalInsidePadding: aMetric = 0; // REVISIT - HACK! + break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; break; default: aMetric = -1; diff --git a/mozilla/widget/src/windows/nsLookAndFeel.cpp b/mozilla/widget/src/windows/nsLookAndFeel.cpp index b6ede8888fb..356979aa48a 100644 --- a/mozilla/widget/src/windows/nsLookAndFeel.cpp +++ b/mozilla/widget/src/windows/nsLookAndFeel.cpp @@ -139,6 +139,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_ListVerticalInsidePadding: aMetric = 0; break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 30; + break; default: aMetric = -1; res = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/xlib/nsLookAndFeel.cpp b/mozilla/widget/src/xlib/nsLookAndFeel.cpp index c1bb2776d40..d4136e47816 100644 --- a/mozilla/widget/src/xlib/nsLookAndFeel.cpp +++ b/mozilla/widget/src/xlib/nsLookAndFeel.cpp @@ -98,6 +98,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) case eMetric_ListVerticalInsidePadding: aMetric = 0; break; + case eMetric_CaretBlinkTime: + aMetric = 500; + break; + case eMetric_CaretWidthTwips: + aMetric = 20; + break; default: aMetric = -1; res = NS_ERROR_FAILURE;