From 271a8baaeb5cbd19047c50681d955c14115fc86f Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 4 Dec 2022 14:04:06 +0100 Subject: Connect on mouse click With this commit the client starts the connection to the server as soon as the user clicks into the application window. Disconnect or reading / writing to the stream is not implemented. --- gui.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gui.c') diff --git a/gui.c b/gui.c index a7f0886..6d0d267 100644 --- a/gui.c +++ b/gui.c @@ -31,6 +31,7 @@ void gui_run(void) { SDL_Renderer* renderer; SDL_Texture* texture; uint32_t* pixels; + int xmpp_fd = -1; // init SDL2 and create window SDL_Init(SDL_INIT_VIDEO); @@ -62,7 +63,9 @@ void gui_run(void) { quit = true; break; case SDL_MOUSEBUTTONDOWN: - xmpp_connect(); + if (xmpp_fd == -1) { + xmpp_fd = xmpp_connect(); + } break; } SDL_RenderClear(renderer); -- cgit v1.2.3-70-g09d2