summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-09-14 12:18:24 +0000
committerMoonchild <moonchild@palemoon.org>2020-09-21 11:00:01 +0000
commiteb1315e093fa9f540aecf35e03a7cf9f7390e55a (patch)
tree55a5257e89be406f2de83c71c3aff12cd18e21f8
parentfa9730a46c87fa774be19cd1bf7f03441cb4650f (diff)
downloadUXP-eb1315e093fa9f540aecf35e03a7cf9f7390e55a.tar
UXP-eb1315e093fa9f540aecf35e03a7cf9f7390e55a.tar.gz
UXP-eb1315e093fa9f540aecf35e03a7cf9f7390e55a.tar.lz
UXP-eb1315e093fa9f540aecf35e03a7cf9f7390e55a.tar.xz
UXP-eb1315e093fa9f540aecf35e03a7cf9f7390e55a.zip
[widget] Clean up Windows widget code some.
-rw-r--r--widget/windows/AudioSession.cpp4
-rw-r--r--widget/windows/CompositorWidgetParent.cpp1
-rw-r--r--widget/windows/IMMHandler.cpp2
-rw-r--r--widget/windows/InkCollector.cpp2
-rw-r--r--widget/windows/KeyboardLayout.cpp5
-rw-r--r--widget/windows/nsAppShell.cpp64
-rw-r--r--widget/windows/nsFilePicker.cpp2
7 files changed, 10 insertions, 70 deletions
diff --git a/widget/windows/AudioSession.cpp b/widget/windows/AudioSession.cpp
index 11e5ba50c..1a83e2964 100644
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -13,7 +13,7 @@
#include "nsIUUIDGenerator.h"
#include "nsIXULAppInfo.h"
-//#include "AudioSession.h"
+#include "AudioSession.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
@@ -27,7 +27,7 @@ namespace mozilla {
namespace widget {
/*
- * To take advantage of what Vista+ have to offer with respect to audio,
+ * To take advantage of what Windows has to offer with respect to audio,
* we need to maintain an audio session. This class wraps IAudioSessionControl
* and implements IAudioSessionEvents (for callbacks from Windows)
*/
diff --git a/widget/windows/CompositorWidgetParent.cpp b/widget/windows/CompositorWidgetParent.cpp
index c784ff72e..238141f56 100644
--- a/widget/windows/CompositorWidgetParent.cpp
+++ b/widget/windows/CompositorWidgetParent.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CompositorWidgetParent.h"
+#include "VsyncDispatcher.h"
#include "mozilla/Unused.h"
diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp
index 9bd7d2e7a..e16517a38 100644
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -17,6 +17,8 @@
#include "mozilla/MiscEvents.h"
#include "mozilla/TextEvents.h"
+using namespace mozilla;
+
#ifndef IME_PROP_ACCEPT_WIDE_VKEY
#define IME_PROP_ACCEPT_WIDE_VKEY 0x20
#endif
diff --git a/widget/windows/InkCollector.cpp b/widget/windows/InkCollector.cpp
index 5383dda7c..3268fe95b 100644
--- a/widget/windows/InkCollector.cpp
+++ b/widget/windows/InkCollector.cpp
@@ -7,6 +7,8 @@
#include "InkCollector.h"
+using namespace mozilla;
+
// Msinkaut_i.c and Msinkaut.h should both be included
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms695519.aspx
#include <msinkaut_i.c>
diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp
index 9166d97d7..b4801fa19 100644
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -39,11 +39,6 @@
#include <winable.h>
#endif
-// In WinUser.h, MAPVK_VK_TO_VSC_EX is defined only when WINVER >= 0x0600
-#ifndef MAPVK_VK_TO_VSC_EX
-#define MAPVK_VK_TO_VSC_EX (4)
-#endif
-
namespace mozilla {
namespace widget {
diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp
index c3e99b2d3..e63d57d89 100644
--- a/widget/windows/nsAppShell.cpp
+++ b/widget/windows/nsAppShell.cpp
@@ -53,9 +53,9 @@ public:
NS_IMETHOD Notify(nsITimer *timer) override {
WAKE_LOCK_LOG("WinWakeLock: periodic timer fired");
- ResetScreenSaverTimeout();
return NS_OK;
}
+
private:
~WinWakeLockListener() {}
@@ -67,75 +67,15 @@ private:
// "locked-foreground" notifications when multipe wake locks are held.
if (aState.EqualsASCII("locked-foreground")) {
WAKE_LOCK_LOG("WinWakeLock: Blocking screen saver");
- // We block the screen saver by periodically resetting the screen
- // saver timeout.
- StartTimer();
- // Prevent the display turning off. On Win7 and later this also
- // blocks the screen saver, but we need the timer started above
- // to block on Win XP and Vista.
+ // Prevent the display turning off.
SetThreadExecutionState(ES_DISPLAY_REQUIRED|ES_CONTINUOUS);
} else {
WAKE_LOCK_LOG("WinWakeLock: Unblocking screen saver");
- // Re-enable screen saver.
- StopTimer();
// Unblock display turning off.
SetThreadExecutionState(ES_CONTINUOUS);
}
return NS_OK;
}
-
- void StartTimer() {
- ResetScreenSaverTimeout();
- MOZ_ASSERT(!mTimer);
- if (mTimer) {
- return;
- }
-
- nsresult rv;
- nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create screen saver timeout reset timer");
- return;
- }
- // The minimum screensaver timeout that can be specified with Windows' UI
- // is 60 seconds. We set a timer to re-jig the screen saver 10 seconds
- // before we expect the timer to run out, but always at least in 1 second
- // intervals. We reset the timer at a max of 50 seconds, so that if the
- // user changes the timeout using the UI, we won't be caught out.
- int32_t timeout = std::max(std::min(50, (int32_t)mScreenSaverTimeout - 10), 1);
- uint32_t timeoutMs = (uint32_t)timeout * 1000;
- WAKE_LOCK_LOG("WinWakeLock: Setting periodic timer for %d ms", timeoutMs);
- rv = timer->InitWithCallback(this,
- timeoutMs,
- nsITimer::TYPE_REPEATING_SLACK);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to initialize screen saver timeout reset timer");
- return;
- }
-
- mTimer = timer.forget();
- }
-
- void StopTimer() {
- WAKE_LOCK_LOG("WinWakeLock: StopTimer()");
- if (!mTimer) {
- return;
- }
- mTimer->Cancel();
- mTimer = nullptr;
- }
-
- // Resets the operating system's timeout for when to disable the screen.
- // Called periodically to keep the screensaver off.
- void ResetScreenSaverTimeout() {
- if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &mScreenSaverTimeout, 0)) {
- SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, mScreenSaverTimeout, NULL, 0);
- }
- WAKE_LOCK_LOG("WinWakeLock: ResetScreenSaverTimeout() mScreenSaverTimeout=%d", mScreenSaverTimeout);
- }
-
- UINT mScreenSaverTimeout = 60;
- nsCOMPtr<nsITimer> mTimer;
};
NS_IMPL_ISUPPORTS(WinWakeLockListener, nsIDOMMozWakeLockListener, nsITimerCallback)
diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp
index 4e942968a..53824b93f 100644
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -220,7 +220,7 @@ STDMETHODIMP nsFilePicker::QueryInterface(REFIID refiid, void** ppvResult)
/*
- * Vista+ callbacks
+ * Callbacks
*/
HRESULT