diff options
-rw-r--r-- | src/imv.c | 6 | ||||
-rw-r--r-- | src/window.c | 9 | ||||
-rw-r--r-- | src/window.h | 3 |
3 files changed, 13 insertions, 5 deletions
@@ -9,8 +9,6 @@ #include <unistd.h> #include <wordexp.h> -#include <GL/gl.h> - #include "backend.h" #include "binds.h" #include "canvas.h" @@ -443,7 +441,6 @@ static void event_handler(void *data, const struct imv_event *e) const int bh = e->data.resize.buffer_height; imv_viewport_update(imv->view, ww, wh, bw, bh, imv->current_image); imv_canvas_resize(imv->canvas, bw, bh); - glViewport(0, 0, bw, bh); break; } case IMV_EVENT_KEYBOARD: @@ -985,8 +982,7 @@ int imv_run(struct imv *imv) } if (imv->need_redraw) { - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); + imv_window_clear(imv->window, 0, 0, 0); render_window(imv); imv_window_present(imv->window); } diff --git a/src/window.c b/src/window.c index ddedf84..8393fa8 100644 --- a/src/window.c +++ b/src/window.c @@ -414,6 +414,7 @@ static void toplevel_configure(void *data, struct xdg_toplevel *toplevel, } } wl_egl_window_resize(window->egl_window, width, height, 0, 0); + glViewport(0, 0, width * window->scale, height * window->scale); struct imv_event e = { .type = IMV_EVENT_RESIZE, @@ -541,6 +542,14 @@ void imv_window_free(struct imv_window *window) free(window); } +void imv_window_clear(struct imv_window *window, unsigned char r, + unsigned char g, unsigned char b) +{ + (void)window; + glClearColor(r / 255.0f, g / 255.0f, b / 255.0f, 1.0); + glClear(GL_COLOR_BUFFER_BIT); +} + void imv_window_get_size(struct imv_window *window, int *w, int *h) { if (w) { diff --git a/src/window.h b/src/window.h index 3e61043..c185b6f 100644 --- a/src/window.h +++ b/src/window.h @@ -46,6 +46,9 @@ struct imv_window *imv_window_create(int w, int h, const char *title); void imv_window_free(struct imv_window *window); +void imv_window_clear(struct imv_window *window, unsigned char r, + unsigned char g, unsigned char b); + void imv_window_get_size(struct imv_window *window, int *w, int *h); void imv_window_get_framebuffer_size(struct imv_window *window, int *w, int *h); |