summaryrefslogtreecommitdiff
path: root/gui.c
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-11-27 19:47:29 +0100
committerxengineering <me@xengineering.eu>2022-11-27 19:47:29 +0100
commit2550cae55865a1f87ae3ec7b71071994ff009c3b (patch)
tree56111cde4cb52d820da5f1cf38ac1057bb06180f /gui.c
parent6e61e0041d46b73d9def181d39a08055cc01318b (diff)
downloadlimox-2550cae55865a1f87ae3ec7b71071994ff009c3b.tar
limox-2550cae55865a1f87ae3ec7b71071994ff009c3b.tar.zst
limox-2550cae55865a1f87ae3ec7b71071994ff009c3b.zip
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.
Diffstat (limited to 'gui.c')
-rw-r--r--gui.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gui.c b/gui.c
index b073570..73c505d 100644
--- a/gui.c
+++ b/gui.c
@@ -6,6 +6,8 @@
#include <SDL2/SDL.h>
#include <stdbool.h>
+#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);