-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_event_handler.c
97 lines (85 loc) · 2.38 KB
/
windows_event_handler.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* ****************************************************** */
/* BSHARA Kinan */
/* rasterIE program */
/* windows_event_handler.c */
/* ****************************************************** */
#include "windows_event_handler.h"
void mac_problem()
{
SDL_Event win_e;
SDL_PollEvent(&win_e);
// if(win_e.type == SDL_WINDOWEVENT){}
}
// void handle_window(SDL_Event *win_e)
void handle_window(void)
{
SDL_Event win_e;
SDL_PollEvent(&win_e);
switch(win_e.type)
{
case SDL_WINDOWEVENT :
{ // this block just scopes 'targetWindow' and 'title'
SDL_Window* selectedWindow = SDL_GetWindowFromID(win_e.window.windowID);
const char *title = SDL_GetWindowTitle(selectedWindow);
switch(win_e.window.event)
{
case SDL_WINDOWEVENT_FOCUS_GAINED :
// tell which window gained focus
break;
case SDL_WINDOWEVENT_FOCUS_LOST :
// tell which window lost focus
break;
case SDL_WINDOWEVENT_CLOSE:
close_window(get_window_id_from_title(title));
break;
}
}
break;
case SDL_QUIT :
break;
}
}
// void *handle_windows(void *arg)
// void handle_windows()
// {
// SDL_Surface *delete;
// int pi = 0;
// int exit_window = 0;
// while(!exit_window)
// {
// SDL_Event win_e;
// while(!exit_window && SDL_PollEvent(&win_e))
// {
// switch(win_e.type)
// {
// case SDL_WINDOWEVENT :
// { // this block just scopes 'targetWindow' and 'title'
// SDL_Window* selectedWindow = SDL_GetWindowFromID(win_e.window.windowID);
// const char *title = SDL_GetWindowTitle(selectedWindow);
// switch(win_e.window.event)
// {
// case SDL_WINDOWEVENT_FOCUS_GAINED :
// // tell which window gained focus
//
// break;
//
// case SDL_WINDOWEVENT_FOCUS_LOST :
// // tell which window lost focus
//
// break;
//
// case SDL_WINDOWEVENT_CLOSE:
// close_window(get_window_id_from_title(title));
// break;
// }
// }
// break;
// case SDL_QUIT :
// exit_window=1;
// break;
// }
// }
// }
// SDL_Quit();
// // return NULL;
// }