From 2550cae55865a1f87ae3ec7b71071994ff009c3b Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 27 Nov 2022 19:47:29 +0100 Subject: Implement XMPP connect on SDL_MOUSEBUTTONDOWN This removes xmpp_connect() from the main loop and delegates the calling to the GUI. This should be the case in the future. --- gui.c | 14 +++++++++----- main.c | 2 -- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gui.c b/gui.c index b073570..73c505d 100644 --- a/gui.c +++ b/gui.c @@ -6,6 +6,8 @@ #include #include +#include "xmpp.h" + void gui_run(void) { @@ -41,11 +43,13 @@ void gui_run(void) { while (!quit) { SDL_UpdateTexture(texture, NULL, pixels, 640 * sizeof(uint32_t)); SDL_WaitEvent(&event); - switch (event.type) - { - case SDL_QUIT: - quit = true; - break; + switch (event.type) { + case SDL_QUIT: + quit = true; + break; + case SDL_MOUSEBUTTONDOWN: + xmpp_connect(); + break; } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); diff --git a/main.c b/main.c index b86e911..a06abf0 100644 --- a/main.c +++ b/main.c @@ -5,7 +5,6 @@ #include #include "gui.h" -#include "xmpp.h" // configuration struct for all command line options @@ -60,7 +59,6 @@ int main(int argc, char* argv[]) { if (opts.unknown || opts.help) { print_help(); } else { - xmpp_connect(); gui_run(); } -- cgit v1.2.3-70-g09d2