Giter VIP home page Giter VIP logo

disperse's People

Contributors

dparker2 avatar rumia-san avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

disperse's Issues

Custom key override

With the settings file, there should be a section to specify specific hotkeys for specific actions, overriding the typical formula (activation+modifiers+action)

Block input

Disperse should swallow input that it recognizes as a hotkey for itself.

This is not possible with the raw input api, which disperse uses. However it is possible with a keyboard hook, except that keyboard hooks will get dropped by the OS if they take too long (even a couple ms), so recognizing and swallowing the inputs should be all it does.

Keyboard hooks also cannot run in the same process as raw input capture... so a complete solution would be two separate processes: one for the raw input and resizing, and one for the keyboard hook to swallow input โ€” assuming the hook would never get dropped by the OS.

GUI for changing settings

Upon clicking the icon in the tray, a window should open with the state of the settings file with descriptions and a way to change the hotkeys

Settings file

First step towards customization is moving the hotkeys to a settings file

The "join()" should be called before the "worker" thread terminates

Hi, ParkerD559
I have compiled your code and run the program. Everything works well until I tried "Quit" in the tray menu. Then the program prints "terminate called without an active exceptionโ€ and crashed.

1

This is because the main thread terminated while the worker thread is still running. Then the thread destructor will be called. However, the thread is still joinable(), and terminate() will be called, which leads to this issue.
The join() method should be called before the worker thread is destructed.

Reference: https://stackoverflow.com/questions/7381757/c-terminate-called-without-an-active-exception

Here is my fix:

std::atomic<bool> quit(false);

void workerMain() {
    while (true) {
        mutex.lock();
        if (!queue.empty()) {
            Tailor::command command = queue.front();
            queue.pop();
            Tailor::alter(command);
        }
        mutex.unlock();
        API::sleep(50);
        if(quit) {
            break;
        }
    }
}
Worker::~Worker() {
    quit = true;
    this->thread_obj.join();
}

I use a atomic bool to escape the loop, and call join() in Worker::~Worker()

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.