Giter Site home page Giter Site logo

stateford / display-lock Goto Github PK

View Code? Open in Web Editor NEW
79.0 3.0 8.0 28.24 MB

Locks cursor to specified window and/or converts windows to borderless fullscreen, and prevents the cursor from spilling into another monitor

Home Page: https://stateford.github.io/Display-Lock/

License: GNU General Public License v3.0

C 85.77% C++ 2.57% Python 9.03% CMake 2.63%
mouse region lock cursor display win32 windows window dual-monitor windowed

display-lock's Introduction

Display Lock

CI CodeFactor

Lightweight program that locks cursor in selected window, designed with performance in mind.

USES


  • Keeps cursor in a windowed game to prevent clicking outside
  • Will stay active while the window is focused
  • Keeps cursor in a fullscreen game while using a multi-monitor setup
  • Converts any window into a borderless and/or fullscreen window (when set in settings)

Contributing


Contributions are always welcome, but please check Contributing guidelines before making a pull request.

EXAMPLE


Download

display-lock's People

Contributors

chelseachelsea avatar rmichelsen avatar stateford avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

display-lock's Issues

Disable Hotkey On Settings Menu

Currently the hotkey button is enabled on the settings menu and should be temporarily disabled until the tab is switched. The key should be unregistered, and re-registered after the switch.
The current hotkey should appear in the Hotkey control box

Appveyor Deployment

Add Appveyor deployment strategies for releases.

  • Automatic signing of application with private keys
  • Automatic deployment to github releases

Refactor Write/Read file to include path as an argument

readSettings() and writeSettings() should take an additional argument of path.

path should be generated from a new function, which checks to see if path exists. If it doesn't exist, it will be created.

  • pass in version instead of determining in the function
  • Separate function to create path

Create application whitelist

Create a whitelist of applications that should be polled for automatically and start locking when displayed.

This feature should have a enable/disable. The polling should stop after the first application is found or disable is clicked. When an application is found all start / stop controls should be disabled.

Logging for debug build

Debug builds should enable logging that will open a file in the users %APPDATA% folder and write to it throughout the duration of the applications lifetime.

This should be simple to implement without external libraries.

Logging code should be placed in it's own project as a static library.

Script to auto increment version.h

Create an auto increment build number for the application. Should appear like this:
2.0.0.{build}

  • Create Version.rc
  • Create Version.h
  • Create script in increment Version.h build number from appveyor

Factor out message loop

The current message loop is too long and too complex. It should be factored out into smaller functions / loops.

Create installer

Display lock should use an installer / uninstaller to clean up any files generated.

This should include the config file.

Check when a window is closed

Check if a window is closed, if it is the following must happen:

  • Stop clipping thread
  • Unlock Menu Options
  • Clear the Combobox

Check for Updates

Create functions to contact server to allow checking for updates

To minimize external dependencies, this should either use native windows bindings for SSL such as or

Create new dialog for creating hotkeys

A new dialog should appear when changing hotkeys.

New hotkeys should be enabled, such as toggling borderless windowed and full screen modes

  • Dialog Box

The code for all of this is within the project

Remove duplicated/unnecessary variables and functions

This will cut down on ram usage. It's currently at 1.2 MB, however we can cut the size down. The point of the program is to squeeze every last ounce of performance as possible, even though it probably doesn't matter on modern systems.

Version header file is broken

Version.h and build script needs to be edited to take the following parameters:

major, minor, revision, build

currently versionRC.rc is only set for 2,0,0,VERSION_BUILD and must be modified

Hotkey Support

Allow the use of hotkeys. There should be an area in the settings to allow the user to set hotkeys for various actions. Config will need to be updated to store hotkeys.

struct SETTINGS {
   int version++;
    ....
   int hotKeyNum;
   HOTKEY hotkeys[hotKeyNum];
}

Possible actions include:

  • Start / Stop
  • Pause / Resume

https://docs.microsoft.com/en-us/windows/desktop/menurc/using-keyboard-accelerators#creating-a-run-time-accelerator-table

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerhotkey

Tasks:

  • Write Tests
  • Create Hotkey Listener
  • Update Settings UI
  • Update Config

Add Window Selection to System Tray Context Menu

We should allow users to select a window from the system tray context menu. This should be fairly simple to implement as the code is already there.

Every time the user right clicks the system tray the submenu item should be cleared and repopulated

Add UI Functions

Move the handling of UI stuff to a function to clean up the main message loops

  • Function for extracting version
  • Function for initializing windows
  • Function for shutting down

Allow locking to specific monitors

Allow locking to specific monitors instead of just windows.

The logic to lock to a RECT object is already in the program, just need to get store an array of monitor objects.

Detect when a window style has changed

Detect when a windows style has changed. For instance starting a lock with borderless fullscreen and changing and option in the menu will cause the window to revert to it's original state.

Settings Menu

Settings


  • Minimize when locking
  • Borderless
  • Fullscreen
  • Bring selected window to foreground
  • Hotkey

Add support for 32-bit

This is fairly easy, I believe the issue is with LoadString() and LoadStringW() on x86/x64

Something like this

#ifdef _X86
#define LOADSTRING LoadString
#else
#define LOADSTRING LoadStringW
#endif

There might be a few other functions, but this should be the cause of the issues.

Allow user to select default monitor

Allow a user to select a default monitor and choose which monitor to display a full screen application on.

Also need an auto detect option which will select the monitor the app is currently on. This will be done by checking against monitors. A struct will need to be made to store monitor information.

typedef struct MONITOR {
    RECT rect;
} MONITOR

MONITOR *monitors = malloc(sizeof(MONITOR) * 3);

Create Tests

Create tests for the following:

  • Setting default settings
  • Reading various settings from files
  • Check File Header
  • Checking file version
  • Rejecting bad files
  • Writing various settings

Move from appveyor to github actions

As soon as github actions are available, This project will be migrated from appveyor to github actions.

  • Build Executable
  • Run Tests
  • Set Version Numbers
  • Deploy Artifacts
  • Deploy Artifacts to release (on git tags)

Improve documentation

Documentation should be improved. Things from the README to how the config system works, and test files.

  • Config System
  • Messages
  • UI Elements
  • Better Comments
  • Tests
  • README.md

Fix alt+tab bug

The issue is caused by the alt-tab view being it's own window, and the list being constantly updated on another thread. This should be fine, but in our case we should only update the list when it is clicked by using the CBN_DROPDOWN event.

Assert Testing for Debug Builds

Debug builds should contain assert testing that are only enabled when the pre-processor flag NDEBUG is defined.

This should be fairly easy. The code should be in it's own C Static Lib and compiled in the main program or in dispLib if the flag is set.

About Window is Missing

The About window is missing.

This should load a string from the resource file and display the current version, as well as a link to either the gh-pages site or the master branch.

Add Settings to System Tray Context Menu

Users should be able to check and uncheck options from the system tray context menu. The code to set things are already in the code base, so this should be a relatively quick thing to implement.

UI will not revert when application is closed

Describe the bug
Closing the game / application will not cause Display Lock to revert the UI to the not running state. The locking threaded loop will stop however.

To Reproduce
Steps to reproduce the behavior:

  1. Start locking an application
  2. Close the application
  3. Notice the UI is still broken

Expected behavior
UI will revert to stopped state when an application is no longer running

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.