aboutsummaryrefslogtreecommitdiff
path: root/include/mgl/window/event.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-08-25 03:06:42 +0200
committerdec05eba <dec05eba@protonmail.com>2023-08-25 10:43:40 +0200
commit30d9f5392fb07105e792963d74786024adc79dd5 (patch)
tree47d21dff4323b03ab738366908f2171ba01a00c4 /include/mgl/window/event.h
parentef4a993d20ceb791ac62dd219ee7d63524e04a3e (diff)
Add monitor events, limit fps to monitor the window is in, reduce latency (glFinish, fps limit)
Diffstat (limited to 'include/mgl/window/event.h')
-rw-r--r--include/mgl/window/event.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/mgl/window/event.h b/include/mgl/window/event.h
index 31af4f1..4813154 100644
--- a/include/mgl/window/event.h
+++ b/include/mgl/window/event.h
@@ -42,6 +42,23 @@ typedef struct {
int y; /* relative to the top of the window */
} mgl_mouse_move_event;
+typedef struct {
+ const char *name; /* This name may only be valid until the next time |mgl_window_poll_event| is called */
+ int id;
+ int x;
+ int y;
+ int width;
+ int height;
+ int refresh_rate; /* 0 if unknown */
+} mgl_monitor_generic_event;
+
+typedef mgl_monitor_generic_event mgl_monitor_connected_event;
+typedef mgl_monitor_generic_event mgl_monitor_property_changed_event;
+
+typedef struct {
+ int id;
+} mgl_monitor_disconnected_event;
+
typedef enum {
MGL_EVENT_UNKNOWN,
MGL_EVENT_CLOSED, /* Window closed */
@@ -54,7 +71,10 @@ typedef enum {
MGL_EVENT_MOUSE_BUTTON_PRESSED,
MGL_EVENT_MOUSE_BUTTON_RELEASED,
MGL_EVENT_MOUSE_WHEEL_SCROLLED,
- MGL_EVENT_MOUSE_MOVED
+ MGL_EVENT_MOUSE_MOVED,
+ MGL_EVENT_MONITOR_CONNECTED,
+ MGL_EVENT_MONITOR_DISCONNECTED,
+ MGL_EVENT_MONITOR_PROPERTY_CHANGED,
} mgl_event_type;
struct mgl_event {
@@ -66,6 +86,9 @@ struct mgl_event {
mgl_mouse_button_event mouse_button;
mgl_mouse_wheel_scroll_event mouse_wheel_scroll;
mgl_mouse_move_event mouse_move;
+ mgl_monitor_connected_event monitor_connected;
+ mgl_monitor_disconnected_event monitor_disconnected;
+ mgl_monitor_property_changed_event monitor_property_changed;
};
};