Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

xterm doesn't accept keyboard input after sdl program quits.

Recommended Posts

I decided to post this here, since chocolate-doom and many other source ports use SDL, and I don't see the same problem after I quit them.

So I'm trying to write a simple game to teach myself "low" level programming. I'm using arch Linux, and I'm not using a window manager. My simple SDL program creates a fullscreen window, blits a blue rectangle to the window surface, updates, cleans everything up and quits. Unforntunately, after the program exits, my xterm no longer reads keyboard input. I can still copy and paste with the mouse, but that's about it. I can't even write anything in vim after (starting it with a copy and paste, of course). Did chocolate-doom face the same problem in development, and how does it get around this issue?


#include <SDL2/SDL.h>

int main(int argc, char **argv) {

 SDL_Window *win;
 SDL_Surface *win_surf;
 SDL_Rect screen_dim;

 screen_dim.x = 0;
 screen_dim.y = 0;
 screen_dim.w = 1280;
 screen_dim.h = 720;

 win = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_SHOWN);

 win_surf = SDL_GetWindowSurface(win);
 SDL_FillRect(win_surf, &screen_dim, (unsigned)0xFFF0F0FF0);




 return 0;

Share this post

Link to post

If you type "reset" and hit enter (even if nothing shows up when you type), does it start working after that?

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now