From 896830e23e8f94b17bdf386c191a885c972ea8a8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 26 Sep 2017 23:45:31 +0200 Subject: gl: Remove GLFW and reinstate FreeGLUT. GLFW doesn't build on Visual Studio 2005 anymore, and I don't have time to keep up with the changes. So, we're switching back to FreeGLUT, which is more stable. I've added the two missing features that made us switch to GLFW in the first place: input methods and system clipboard support. If MuPDF is compiled with our version of FreeGLUT, we now use these functions: * glutKeyboardExtFunc * glutSetClipboard * glutGetClipboard --- platform/gl/gl-input.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'platform/gl/gl-input.c') diff --git a/platform/gl/gl-input.c b/platform/gl/gl-input.c index 7ea9bafa..db42cace 100644 --- a/platform/gl/gl-input.c +++ b/platform/gl/gl-input.c @@ -112,18 +112,18 @@ static int ui_input_key(struct input *input) switch (ui.key) { case KEY_LEFT: - if (ui.mod == GLFW_MOD_CONTROL + GLFW_MOD_SHIFT) + if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT) { input->q = prev_word(input->q, input->text); } - else if (ui.mod == GLFW_MOD_CONTROL) + else if (ui.mod == GLUT_ACTIVE_CTRL) { if (input->p != input->q) input->p = input->q = input->p < input->q ? input->p : input->q; else input->p = input->q = prev_word(input->q, input->text); } - else if (ui.mod == GLFW_MOD_SHIFT) + else if (ui.mod == GLUT_ACTIVE_SHIFT) { if (input->q > input->text) input->q = prev_char(input->q, input->text); @@ -137,18 +137,18 @@ static int ui_input_key(struct input *input) } break; case KEY_RIGHT: - if (ui.mod == GLFW_MOD_CONTROL + GLFW_MOD_SHIFT) + if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT) { input->q = next_word(input->q, input->end); } - else if (ui.mod == GLFW_MOD_CONTROL) + else if (ui.mod == GLUT_ACTIVE_CTRL) { if (input->p != input->q) input->p = input->q = input->p > input->q ? input->p : input->q; else input->p = input->q = next_word(input->q, input->end); } - else if (ui.mod == GLFW_MOD_SHIFT) + else if (ui.mod == GLUT_ACTIVE_SHIFT) { if (input->q < input->end) input->q = next_char(input->q); @@ -163,15 +163,15 @@ static int ui_input_key(struct input *input) break; case KEY_UP: case KEY_HOME: - if (ui.mod == GLFW_MOD_CONTROL + GLFW_MOD_SHIFT) + if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT) { input->q = input->text; } - else if (ui.mod == GLFW_MOD_CONTROL) + else if (ui.mod == GLUT_ACTIVE_CTRL) { input->p = input->q = input->text; } - else if (ui.mod == GLFW_MOD_SHIFT) + else if (ui.mod == GLUT_ACTIVE_SHIFT) { input->q = input->text; } @@ -182,15 +182,15 @@ static int ui_input_key(struct input *input) break; case KEY_DOWN: case KEY_END: - if (ui.mod == GLFW_MOD_CONTROL + GLFW_MOD_SHIFT) + if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT) { input->q = input->end; } - else if (ui.mod == GLFW_MOD_CONTROL) + else if (ui.mod == GLUT_ACTIVE_CTRL) { input->p = input->q = input->end; } - else if (ui.mod == GLFW_MOD_SHIFT) + else if (ui.mod == GLUT_ACTIVE_SHIFT) { input->q = input->end; } @@ -254,20 +254,20 @@ static int ui_input_key(struct input *input) char *q = input->p > input->q ? input->p : input->q; memmove(buf, p, q - p); buf[q-p] = 0; - glfwSetClipboardString(window, buf); + ui_set_clipboard(buf); if (ui.key == KEY_CTL_X) ui_input_delete_selection(input); } break; case KEY_CTL_V: { - const char *buf = glfwGetClipboardString(window); + const char *buf = ui_get_clipboard(); if (buf) ui_input_paste(input, buf, (int)strlen(buf)); } break; default: - if (ui.key >= 32) + if (ui.key >= 32 && ui.plain) { int cat = ucdn_get_general_category(ui.key); if (ui.key == ' ' || (cat >= UCDN_GENERAL_CATEGORY_LL && cat < UCDN_GENERAL_CATEGORY_ZL)) -- cgit v1.2.3