You are not logged in.

#1 2017-05-02 05:48:09

insanoflex
Member
Registered: 2017-04-29
Posts: 15

xterm doesn't read keyboard input after SDL program quits.

After trying and quitting creating a writeable framebuffer using bare xlib, I've decided to give SDL a try. 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). Other SDL programs I've run don't seem to face this issue, namely, chocolate-doom.
Code:

#include <SDL2/SDL.h>

int main(int argc, char **argv) {
	SDL_Init(SDL_INIT_EVERYTHING);

	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); 

	SDL_UpdateWindowSurface(win);

	SDL_Delay(2000);

	SDL_DestroyWindow(win);
	SDL_Quit();

	return 0;
}

Offline

Board footer

Powered by FluxBB