-
Notifications
You must be signed in to change notification settings - Fork 0
/
display-gtk.c
59 lines (45 loc) · 1.31 KB
/
display-gtk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (C) 2018, Jason Parker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <string.h>
#include "include/lamprey.h"
#include "include/controller.h"
#include "include/display.h"
hl_thread_t t_gtk;
hl_mutex_t mutex_gtk;
void print_hello(GtkWidget *widget, gpointer data) {
g_print("Hello World\n");
}
void hl_gtk_init(int argc, char **argv) {
gtk_init(&argc, &argv);
/* Spawn another thread for gtk window handling. */
hl_mutex_create(&mutex_gtk);
hl_mutex_lock(&mutex_gtk);
hl_thread_create(&t_gtk, hl_gtk_show, NULL);
hl_mutex_unlock(&mutex_gtk);
}
void *hl_gtk_show(void *ptr) {
//TODO Add locking?
GtkBuilder *builder;
GtkWidget *window;
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "glade/display.glade", NULL);
window = GTK_WIDGET(gtk_builder_get_object(builder, "window_display"));
gtk_builder_connect_signals(builder, NULL);
g_object_unref(builder);
gtk_widget_show(window);
gtk_main();
hl_gtk_destroy();
return NULL;
}
void hl_gtk_destroy() {
hl_thread_exit();
}
void hl_gtk_output_controller(struct controller *controller) {
}