태그된 질문 보이기: 모든 질문 보이기

Here's working C# source code to open and arrange 3 Firefox browsers on a 4K monitor wtih Windows

modify to suit your tastes or improve it? working now without any known issues. using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; name… (자세히 살펴보기)

modify to suit your tastes or improve it? working now without any known issues.

using System.Diagnostics; using System.Runtime.InteropServices; using System.Text;

namespace FirefoxWindowPositioner {

   class Program {
       [DllImport("user32.dll", SetLastError = true)]
       private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
       [DllImport("user32.dll", SetLastError = true)]
       private static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
       [DllImport("user32.dll", SetLastError = true)]
       private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
       [DllImport("user32.dll")]
       [return: MarshalAs(UnmanagedType.Bool)]
       private static extern bool IsWindowVisible(IntPtr hWnd);
       [DllImport("user32.dll", SetLastError = true)]
       private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
       [DllImport("user32.dll", SetLastError = true)]
       private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
       [DllImport("user32.dll", SetLastError = true)]
       private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
       private const uint GW_OWNER = 4;
       private const int MaxRetries = 100;
       private const int SleepTime = 200;
       private const string ClassNameToFind = "MozillaWindowClass";
       private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
       private static IntPtr foundWindowHandle = IntPtr.Zero;
       private static bool EnumWindowsCallback(IntPtr hWnd, IntPtr lParam) {
           uint processId;
           GetWindowThreadProcessId(hWnd, out processId);
           if (IsWindowVisible(hWnd) && GetWindow(hWnd, GW_OWNER) == IntPtr.Zero) {
               StringBuilder className = new StringBuilder(256);
               GetClassName(hWnd, className, className.Capacity);
               if (className.ToString() == ClassNameToFind) {
                   foundWindowHandle = hWnd;
                   Console.WriteLine($"Found window handle {hWnd} for process ID {processId}");
                   return false; // Stop enumerating windows once the desired window is found
               }
           }
           return true; // Continue enumerating windows
       }
       static void Main(string[] args) {
           string path = @"C:\Program Files\Mozilla Firefox\firefox.exe";
           // Define positions and sizes
           int[,] positions = new int[,]
           {
               {0, 0, 1284, 2120},
               {1280, 0, 1284, 2120},
               {2560, 0, 1284, 2120}
           };
           int initialDelay = 750; // Initial delay in milliseconds, 1000 worked
           int retryDelay = 200; // Delay between retries in milliseconds
           // Start three Firefox processes sequentially and move them to specified positions
           for (int i = 0; i < 3; i++) {
               Process firefoxProcess = Process.Start(path);
               Thread.Sleep(initialDelay); // Wait for the process to initialize
               foundWindowHandle = IntPtr.Zero;
               int retries = 0;
               while (foundWindowHandle == IntPtr.Zero && retries < MaxRetries) {
                   EnumWindows(EnumWindowsCallback, IntPtr.Zero);
                   if (foundWindowHandle == IntPtr.Zero) {
                       Thread.Sleep(retryDelay); // Wait before retrying
                       retries++;
                   }
               }
               if (foundWindowHandle != IntPtr.Zero) {
                   bool success = MoveWindow(foundWindowHandle, positions[i, 0], positions[i, 1], positions[i, 2], positions[i, 3], true);
                   if (success) {
                       Console.WriteLine($"Moved window {i + 1} to X: {positions[i, 0]}, Y: {positions[i, 1]}, Width: {positions[i, 2]}, Height: {positions[i, 3]}");
                   } else {
                       Console.WriteLine($"Failed to move window {i + 1}");
                   }
               } else {
                   Console.WriteLine($"Failed to get handle for Firefox process {i + 1}");
               }
           }
       }
   }

}

2시간 전에 FireFoxCustomWannabe님이 질문

Disabling GPU process fixes stuttering on external display on dual-GPU Optimus laptop

My configuration is the following: Windows 11, internal display connected to iGPU and external UHD display to nvidia-HDMI port, multiple firefox windows are opened (1 one… (자세히 살펴보기)

My configuration is the following: Windows 11, internal display connected to iGPU and external UHD display to nvidia-HDMI port, multiple firefox windows are opened (1 one the internal screen, 2 on the external).

Then in Windows->Settings->GPU I can select firefox to run on either iGPU (powersaving) or on Nvidia GPU (max perf), the problem is the following: Whenever I set firefox running on iGPU, there would be a massive stuttering/framedrop on an external display (connected to NVIDIA), while a perfectly smooth browsing on internal display, and vice versa.

My first attempt was to disable webrenderer compositor or switching it to a software rendering, which fixes the heavy stuttering, but the scrolling becomes overall less fluid/responsive.

However, setting "layers.gpu-process.enabled" to "false" seemingly solves this problem completely. Now I have a perfectly smooth scrolling on both displays, regardless of which GPU is used in Windows->Settings->GPU (nvidia's is arguably a little but more responsive).

Hope this helps someone, or maybe dev team could look deeper into this.

Thank you for the great browser!

5일 전에 Alexey Samosyuk님이 질문