static gboolean _GuiGtkDrawingArea_resizeCallback (GuiObject widget, GtkAllocation *allocation, gpointer void_me) { iam (GuiDrawingArea); if (my resizeCallback) { struct structGuiDrawingAreaResizeEvent event = { widget, 0 }; event. width = allocation -> width; event. height = allocation -> height; //g_debug("%d %d", allocation->width, allocation->height); my resizeCallback (my clickBoss, & event); return TRUE; } return FALSE; }
void _GuiMacDrawingArea_shellResize (GuiObject widget) { iam_drawingarea; if (my resizeCallback) { struct structGuiDrawingAreaResizeEvent event = { widget, 0 }; event. width = widget -> width; event. height = widget -> height; try { my resizeCallback (my resizeBoss, & event); } catch (MelderError) { Melder_flushError ("Window resizing not completely handled."); } } }
static gboolean _GuiGtkDrawingArea_resizeCallback (GuiObject widget, GtkAllocation *allocation, gpointer void_me) { iam (GuiDrawingArea); if (my resizeCallback) { struct structGuiDrawingAreaResizeEvent event = { widget, 0 }; event. width = allocation -> width; event. height = allocation -> height; //g_debug("%d %d", allocation->width, allocation->height); try { my resizeCallback (my clickBoss, & event); } catch (MelderError) { Melder_flushError ("Window resizing not completely handled."); } return TRUE; } return FALSE; }
void Windows::init(void) { glfwSetErrorCallback(errorCallback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_SAMPLES, 4); // antialiasing glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_RESIZABLE, true); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true); // if debug // glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); m_window = glfwCreateWindow(m_width, m_height, m_title, NULL, NULL); if (!m_window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(m_window, Keyboard::callback); glfwSetFramebufferSizeCallback(m_window, resizeCallback); glfwMakeContextCurrent(m_window); glewExperimental = true; if (glewInit() != GLEW_OK) { std::cerr << "Failed to initialize GLEW" << std::endl; exit(EXIT_FAILURE); } glfwSwapInterval(1); // vsync glfwGetFramebufferSize(m_window, &m_width, &m_height); resizeCallback(m_window, m_width, m_height); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); }