mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	yuzu: Ensure mouse panning can't be enabled with real mouse emulation
This commit is contained in:
		@@ -3105,21 +3105,6 @@
 | 
			
		||||
                    </property>
 | 
			
		||||
                    <item>
 | 
			
		||||
                     <widget class="QPushButton" name="mousePanningButton">
 | 
			
		||||
                      <property name="minimumSize">
 | 
			
		||||
                       <size>
 | 
			
		||||
                        <width>68</width>
 | 
			
		||||
                        <height>0</height>
 | 
			
		||||
                       </size>
 | 
			
		||||
                      </property>
 | 
			
		||||
                      <property name="maximumSize">
 | 
			
		||||
                       <size>
 | 
			
		||||
                        <width>68</width>
 | 
			
		||||
                        <height>16777215</height>
 | 
			
		||||
                       </size>
 | 
			
		||||
                      </property>
 | 
			
		||||
                      <property name="styleSheet">
 | 
			
		||||
                       <string notr="true">min-width: 68px;</string>
 | 
			
		||||
                      </property>
 | 
			
		||||
                      <property name="text">
 | 
			
		||||
                       <string>Configure</string>
 | 
			
		||||
                      </property>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#include <QCloseEvent>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
#include "common/settings.h"
 | 
			
		||||
#include "ui_configure_mouse_panning.h"
 | 
			
		||||
@@ -33,13 +34,20 @@ void ConfigureMousePanning::SetConfiguration(float right_stick_deadzone, float r
 | 
			
		||||
    ui->min_decay->setValue(Settings::values.mouse_panning_min_decay.GetValue());
 | 
			
		||||
 | 
			
		||||
    if (right_stick_deadzone > 0.0f || right_stick_range != 1.0f) {
 | 
			
		||||
        ui->warning_label->setText(QString::fromStdString(
 | 
			
		||||
            "Mouse panning works better with a deadzone of 0% and a range of 100%.\n"
 | 
			
		||||
            "Current values are " +
 | 
			
		||||
            std::to_string(static_cast<int>(right_stick_deadzone * 100.0f)) + "% and " +
 | 
			
		||||
            std::to_string(static_cast<int>(right_stick_range * 100.0f)) + "% respectively."));
 | 
			
		||||
    } else {
 | 
			
		||||
        ui->warning_label->hide();
 | 
			
		||||
        const QString right_stick_deadzone_str =
 | 
			
		||||
            QString::fromStdString(std::to_string(static_cast<int>(right_stick_deadzone * 100.0f)));
 | 
			
		||||
        const QString right_stick_range_str =
 | 
			
		||||
            QString::fromStdString(std::to_string(static_cast<int>(right_stick_range * 100.0f)));
 | 
			
		||||
 | 
			
		||||
        ui->warning_label->setText(
 | 
			
		||||
            tr("Mouse panning works better with a deadzone of 0% and a range of 100%.\nCurrent "
 | 
			
		||||
               "values are %1% and %2% respectively.")
 | 
			
		||||
                .arg(right_stick_deadzone_str, right_stick_range_str));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (Settings::values.mouse_enabled) {
 | 
			
		||||
        ui->warning_label->setText(
 | 
			
		||||
            tr("Emulated mouse is enabled. This is incompatible with mouse panning."));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -69,5 +77,14 @@ void ConfigureMousePanning::ApplyConfiguration() {
 | 
			
		||||
    Settings::values.mouse_panning_decay_strength = static_cast<float>(ui->decay_strength->value());
 | 
			
		||||
    Settings::values.mouse_panning_min_decay = static_cast<float>(ui->min_decay->value());
 | 
			
		||||
 | 
			
		||||
    if (Settings::values.mouse_enabled && Settings::values.mouse_panning) {
 | 
			
		||||
        Settings::values.mouse_panning = false;
 | 
			
		||||
        QMessageBox::critical(
 | 
			
		||||
            this, tr("Emulated mouse is enabled"),
 | 
			
		||||
            tr("Real mouse input and mouse panning are incompatible. Please disable the "
 | 
			
		||||
               "emulated mouse in input advanced settings to allow mouse panning."));
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    accept();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,10 +9,10 @@
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QCheckBox" name="enable">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Enable</string>
 | 
			
		||||
      <string>Enable mouse panning</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="toolTip">
 | 
			
		||||
      <string>Can be toggled via a hotkey</string>
 | 
			
		||||
      <string>Can be toggled via a hotkey. Default hotkey is Ctrl + F9</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user