Skip to content

Commit

Permalink
Fix for stopped working error, relative mode sensitivity, etc.
Browse files Browse the repository at this point in the history
- Fixed "TabletDriverService.exe has stopped working" error when a tablet is not connected.
- Relative mouse mode can now have different sensitivity on X and Y axis.
- Added SendInput output mode to GUI
- Support for VEIKK's VMulti driver with a higher pressure sensitivity resolution in the digitizer mode.
  • Loading branch information
hawku committed Dec 16, 2018
1 parent b5a7d93 commit f8e388d
Show file tree
Hide file tree
Showing 25 changed files with 731 additions and 560 deletions.
3 changes: 2 additions & 1 deletion TabletDriverGUI/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public enum OutputModes
{
Absolute = 0,
Relative = 1,
Digitizer = 2
Digitizer = 2,
SendInput = 3
}

public Area ScreenArea;
Expand Down
22 changes: 16 additions & 6 deletions TabletDriverGUI/MainWindow.Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,24 @@ private void SendSettingsToDriver()
switch (config.OutputMode)
{
case Configuration.OutputModes.Absolute:
settingCommands.Add("Mode Absolute");
settingCommands.Add("OutputMode Absolute");
break;
case Configuration.OutputModes.Relative:
settingCommands.Add("Mode Relative");
settingCommands.Add("RelativeSensitivity " + Utils.GetNumberString(config.ScreenArea.Width / config.TabletArea.Width));
settingCommands.Add("OutputMode Relative");
settingCommands.Add("RelativeSensitivity " +
Utils.GetNumberString(config.ScreenArea.Width / config.TabletArea.Width) +
" " +
Utils.GetNumberString(config.ScreenArea.Height / config.TabletArea.Height)
);
break;
case Configuration.OutputModes.Digitizer:
settingCommands.Add("Mode Digitizer");
settingCommands.Add("OutputMode Digitizer");
break;

case Configuration.OutputModes.SendInput:
settingCommands.Add("OutputMode SendInputAbsolute");
break;

}

//
Expand Down Expand Up @@ -403,12 +412,13 @@ private void ProcessStatusMessage(string variableName, string parameters)
if (Utils.ParseNumber(parameters, out double test))
{
tabletButtonCount = (int)test;
if(tabletButtonCount > 0)
if (tabletButtonCount > 0)
{
for (int i = 0; i < 16; i++)
{
GroupBox box = (GroupBox)wrapPanelTabletButtons.Children[i];
if (i >= tabletButtonCount) {
if (i >= tabletButtonCount)
{
box.Visibility = Visibility.Collapsed;
}
else
Expand Down
78 changes: 71 additions & 7 deletions TabletDriverGUI/MainWindow.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ private void LoadSettingsFromConfiguration()
case Configuration.OutputModes.Digitizer:
radioModeDigitizer.IsChecked = true;
break;
case Configuration.OutputModes.SendInput:
radioModeSendInput.IsChecked = true;
break;
}


Expand Down Expand Up @@ -312,8 +315,9 @@ private void UpdateSettingsToConfiguration()
// Output Mode
//
if (radioModeAbsolute.IsChecked == true) config.OutputMode = Configuration.OutputModes.Absolute;
if (radioModeRelative.IsChecked == true) config.OutputMode = Configuration.OutputModes.Relative;
if (radioModeDigitizer.IsChecked == true) config.OutputMode = Configuration.OutputModes.Digitizer;
else if (radioModeRelative.IsChecked == true) config.OutputMode = Configuration.OutputModes.Relative;
else if (radioModeDigitizer.IsChecked == true) config.OutputMode = Configuration.OutputModes.Digitizer;
else if (radioModeSendInput.IsChecked == true) config.OutputMode = Configuration.OutputModes.SendInput;


//
Expand Down Expand Up @@ -527,6 +531,42 @@ private void UpdateSettingsToConfiguration()

}



//
// Initialize configuration
//
private void InitializeConfiguration()
{
isLoadingSettings = true;
Width = config.WindowWidth;
Height = config.WindowHeight;
isLoadingSettings = false;

// Invalid config -> Set defaults
if (config.ScreenArea.Width == 0 || config.ScreenArea.Height == 0)
{
config.DesktopSize.Width = GetVirtualDesktopSize().Width;
config.DesktopSize.Height = GetVirtualDesktopSize().Height;
config.ScreenArea.Width = config.DesktopSize.Width;
config.ScreenArea.Height = config.DesktopSize.Height;
config.ScreenArea.X = 0;
config.ScreenArea.Y = 0;
}

// Create canvas elements
CreateCanvasElements();

// Load settings from configuration
LoadSettingsFromConfiguration();

// Update the settings back to the configuration
UpdateSettingsToConfiguration();

// Set run at startup
SetRunAtStartup(config.RunAtStartup);
}

#endregion


Expand Down Expand Up @@ -593,7 +633,7 @@ System.Drawing.Rectangle GetVirtualDesktopSize()
System.Drawing.Rectangle rect = new System.Drawing.Rectangle();

// Windows 8 or greater needed for the multiscreen absolute mode
if (VersionHelper.IsWindows8OrGreater() || config.OutputMode == Configuration.OutputModes.Digitizer)
if (VersionHelper.IsWindows8OrGreater() || config.OutputMode != Configuration.OutputModes.Absolute)
{
rect.Width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
rect.Height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;
Expand All @@ -616,7 +656,7 @@ System.Windows.Forms.Screen[] GetAvailableScreens()
System.Windows.Forms.Screen[] screens;

// Windows 8 or greater needed for the multiscreen absolute mode
if (VersionHelper.IsWindows8OrGreater() || config.OutputMode == Configuration.OutputModes.Digitizer)
if (VersionHelper.IsWindows8OrGreater() || config.OutputMode != Configuration.OutputModes.Absolute)
screens = System.Windows.Forms.Screen.AllScreens;
else
screens = new System.Windows.Forms.Screen[] { System.Windows.Forms.Screen.PrimaryScreen };
Expand Down Expand Up @@ -1007,7 +1047,7 @@ private void Canvas_MouseMove(object sender, MouseEventArgs e)
dx = 0;
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
dy = 0;


// Screen map canvas
if (mouseDrag.Source == canvasScreenMap)
Expand Down Expand Up @@ -1323,7 +1363,9 @@ private void ButtonMap_ToolTipOpening(object sender, ToolTipEventArgs e)
private void MainMenuClick(object sender, RoutedEventArgs e)
{

// Import
//
// Import settings
//
if (sender == mainMenuImport)
{
OpenFileDialog dialog = new OpenFileDialog
Expand All @@ -1348,7 +1390,9 @@ private void MainMenuClick(object sender, RoutedEventArgs e)
}
}

// Export
//
// Export settings
//
else if (sender == mainMenuExport)
{
SaveFileDialog dialog = new SaveFileDialog
Expand Down Expand Up @@ -1376,7 +1420,27 @@ private void MainMenuClick(object sender, RoutedEventArgs e)

}

//
// Reset to default
//
else if (sender == mainMenuResetToDefault)
{
config = null;
isFirstStart = true;
config = new Configuration();

// Initialize configuration
InitializeConfiguration();

// Restart driver
StopDriver();
StartDriver();

}

//
// Exit
//
else if (sender == mainMenuExit)
{
Close();
Expand Down
Loading

0 comments on commit f8e388d

Please sign in to comment.