Fixed wrong trackpad scrolling.

This commit is contained in:
Yuval Dolev 2020-01-19 04:44:52 +02:00
parent 00d8206ad2
commit 63b964f1c5
3 changed files with 16 additions and 5 deletions

View File

@ -310,13 +310,23 @@ metal__make_buffer(u32 size, id<MTLDevice> 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<MTLCommandBuffer> command_buffer = [command_queue commandBuffer];
command_buffer.label = @"4coder Metal Render Command";

View File

@ -285,7 +285,6 @@ 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){

View File

@ -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;