From 63b964f1c51408c9b8a87e28cd576dd941207501 Mon Sep 17 00:00:00 2001 From: Yuval Dolev Date: Sun, 19 Jan 2020 04:44:52 +0200 Subject: [PATCH] Fixed wrong trackpad scrolling. --- metal/4ed_metal_render.mm | 12 +++++++++++- opengl/4ed_opengl_render.cpp | 3 +-- platform_mac/mac_4ed.mm | 6 ++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/metal/4ed_metal_render.mm b/metal/4ed_metal_render.mm index fc789cb9..ad902b27 100644 --- a/metal/4ed_metal_render.mm +++ b/metal/4ed_metal_render.mm @@ -310,13 +310,23 @@ metal__make_buffer(u32 size, id device){ #endif // HACK(yuval): This is the best way I found to force valid width and height without drawing on the next draw cycle (1 frame delay). - CGSize drawable_size = [view drawableSize]; i32 width = (i32)Min(_target->width, drawable_size.width); i32 height = (i32)Min(_target->height, drawable_size.height); Font_Set *font_set = (Font_Set*)_target->font_set; + // TODO(yuval): Free any textures in the target's texture free list +#if 0 + for (Render_Free_Texture *free_texture = _target->free_texture_first; + free_texture; + free_texture = free_texture->next){ + /*sll_queue_push(texture_slots.first_free_slot, texture_slots.last_free_slot, free_texture)*/ + } + _target->free_texture_first = 0; + _taget->free_texture_last = 0; +#endif + // NOTE(yuval): Create the command buffer id command_buffer = [command_queue commandBuffer]; command_buffer.label = @"4coder Metal Render Command"; diff --git a/opengl/4ed_opengl_render.cpp b/opengl/4ed_opengl_render.cpp index 9daddb2d..0d1ad918 100644 --- a/opengl/4ed_opengl_render.cpp +++ b/opengl/4ed_opengl_render.cpp @@ -285,12 +285,11 @@ gl_render(Render_Target *t){ t->free_texture_first = 0; t->free_texture_last = 0; - u64 begin_draw = system_now_time(); for (Render_Group *group = t->group_first; group != 0; group = group->next){ Rect_i32 box = Ri32(group->clip_box); - + Rect_i32 scissor_box = { box.x0, height - box.y1, box.x1 - box.x0, box.y1 - box.y0, }; diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index 09dcc170..3239cca2 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -952,9 +952,11 @@ mac_toggle_fullscreen(void){ float dx = event.scrollingDeltaX; float dy = event.scrollingDeltaY; - i8 scroll_speed = 100; + i8 scroll_speed = 0; if (dy > 0){ - scroll_speed *= -1; + scroll_speed = -100; + } else if (dy < 0){ + scroll_speed = 100; } mac_vars.input_chunk.trans.mouse_wheel = scroll_speed;