aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mgl/gl.h2
-rw-r--r--include/mgl/mgl.h6
-rw-r--r--include/mgl/window/event.h25
-rw-r--r--include/mgl/window/window.h15
4 files changed, 47 insertions, 1 deletions
diff --git a/include/mgl/gl.h b/include/mgl/gl.h
index cf2cd47..c1059b6 100644
--- a/include/mgl/gl.h
+++ b/include/mgl/gl.h
@@ -77,6 +77,8 @@ typedef struct {
const unsigned char* (*glGetString)(unsigned int name);
void (*glGetIntegerv)(unsigned int pname, int *params);
void (*glPixelStorei)(unsigned int pname, int param);
+ void (*glFlush)(void);
+ void (*glFinish)(void);
/* Optional*/
void (*glXSwapIntervalEXT)(Display * dpy, GLXDrawable drawable, int interval);
diff --git a/include/mgl/mgl.h b/include/mgl/mgl.h
index f2373b7..4e1a181 100644
--- a/include/mgl/mgl.h
+++ b/include/mgl/mgl.h
@@ -13,6 +13,12 @@ struct mgl_context {
unsigned long wm_delete_window_atom;
unsigned long net_wm_ping_atom;
unsigned long net_wm_pid_atom;
+
+ int render_event_base;
+ int render_error_base;
+
+ int randr_event_base;
+ int randr_error_base;
};
/*
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;
};
};
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h
index cb5a2eb..35b677d 100644
--- a/include/mgl/window/window.h
+++ b/include/mgl/window/window.h
@@ -27,9 +27,19 @@ typedef struct {
mgl_vec2i size;
} mgl_scissor;
+typedef struct {
+ int id; /* output id */
+ int crtc_id;
+ const char *name;
+ mgl_vec2i pos;
+ mgl_vec2i size;
+ int refresh_rate;
+} mgl_monitor;
+
struct mgl_window {
mgl_window_handle window;
void *context;
+ mgl_vec2i pos;
mgl_vec2i size;
/* relative to the top left of the window. only updates when the cursor is inside the window */
mgl_vec2i cursor_position;
@@ -40,11 +50,16 @@ struct mgl_window {
bool key_repeat_enabled;
bool vsync_enabled;
double frame_time_limit;
+ double frame_time_limit_monitor;
mgl_clock frame_timer;
char *clipboard_string;
size_t clipboard_size;
+
+ mgl_monitor *monitors; /* TODO: Move these to mgl file */
+ int num_monitors;
};
+/* TODO: Some of these parameters only apply to new window */
typedef struct {
mgl_vec2i position;
mgl_vec2i size;