Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] SDL2 Event_Drop do not work with CMder #2881

Closed
4 tasks done
bovacu opened this issue Oct 15, 2023 · 1 comment
Closed
4 tasks done

[Bug] SDL2 Event_Drop do not work with CMder #2881

bovacu opened this issue Oct 15, 2023 · 1 comment

Comments

@bovacu
Copy link

bovacu commented Oct 15, 2023

Version Information

Cmder version: 1.5.9
Operating system: Windows 11

Cmder Edition

Cmder Full (with Git)

Description of the issue

I'm working on my C-GameEngine on Windows 11 and I use Cmder as my working terminal and I compile with plain clang (no IDE). When I use any other native windows terminal (CMD or PowerShell) both support SDL2 Drop events, such as DropBegin, DropComplete, DropFile and DropText, but with Cmder those events are simply not working, they are not even poll at all, it is like they do not exist for Cmder. If I simply run my program by double clicking they work as expected, it is just by running the program on Cmder.
It can be reproduced with the simple example of the wiki, here it is:

#include "SDL.h"

int main(int argc, char *argv[]) {
    SDL_bool done;
    SDL_Window *window;
    SDL_Event event;                        // Declare event handle
    char* dropped_filedir;                  // Pointer for directory of dropped file

    SDL_Init(SDL_INIT_VIDEO);               // SDL2 initialization

    window = SDL_CreateWindow(  // Create a window
        "SDL_DropEvent usage, please drop the file on window",
        SDL_WINDOWPOS_CENTERED,
        SDL_WINDOWPOS_CENTERED,
        640,
        480,
        SDL_WINDOW_OPENGL
    );

    // Check that the window was successfully made
    if (window == NULL) {
        // In the event that the window could not be made...
        SDL_Log("Could not create window: %s", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    SDL_EventState(SDL_DROPFILE, SDL_ENABLE);

    done = SDL_FALSE;
    while (!done) {                         // Program loop
        while (!done && SDL_PollEvent(&event)) {
            switch (event.type) {
                case (SDL_QUIT): {          // In case of exit
                    done = SDL_TRUE;
                    break;
                }

                case (SDL_DROPFILE): {      // In case if dropped file
                    dropped_filedir = event.drop.file;
                    // Shows directory of dropped file
                    SDL_ShowSimpleMessageBox(
                        SDL_MESSAGEBOX_INFORMATION,
                        "File dropped on window",
                        dropped_filedir,
                        window
                    );
                    SDL_free(dropped_filedir);    // Free dropped_filedir memory
                    break;
               }
            }
        }
        SDL_Delay(0);
    }

    SDL_DestroyWindow(window);        // Close and destroy the window

    SDL_Quit();                       // Clean up
    return 0;
}

Just compile that program and see how it behaves in from the terminal and just from double clicking. Is this a known error? I could not find that much information about this problem. If anyone knows something on why this is happening or how to fix it, let me know pls!

Thank you so much in advance.

How to reproduce

  1. Windows 11
  2. Use Cmder
  3. Compile (above program) with clang -g -O0 main.cpp -I path/to/sdl2/include -L path/to/sdl/lib -lSDL2main -lSDL2 -lwinmm -lgdi32 -Xlinker /subsystem:console -lShell32 -o main.exe
  4. Run the generated program with Cmder (do not work), then run it by double click on the file explorer (works) and also on other terminal (like CMD, and it works)

Additional context

No response

Checklist

  • I have read the documentation.
  • I have searched for similar issues and found none that describe my issue.
  • I have reproduced the issue on the latest version of Cmder.
  • I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.
@chrisant996
Copy link
Contributor

Terminals show output from programs and accept input and pass the input to programs.

CMD and Powershell are shell programs, not terminals.

ConEmu and Windows Terminal are terminals. When no terminal program is launched, then the default terminal is launched. On older versions of Windows it's the legacy conhost terminal, and on newer versions it's Windows Terminal.

Cmder is a package that bundles some scripts and the ConEmu terminal.

Try posting the question in the ConEmu repo. Cmder doesn't own or modify the ConEmu terminal.

Also, it may be an issue in the SDL code, so posting the question to the SDL maintainers could also be useful.

@daxgames daxgames closed this as completed Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants