dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

wheel-zoom.patch (1647B)


      1 --- a/kitty/mouse.c
      2 +++ b/kitty/mouse.c
      3 @@ -1503,6 +1503,30 @@
      4  void
      5  scroll_event(const GLFWScrollEvent *ev) {
      6      debug("\x1b[36mScroll\x1b[m type=%s x: %f y: %f momentum: %s modifiers: %s\n", scroll_offset_type(ev->offset_type), ev->x_offset, ev->y_offset, scroll_phase(ev->momentum_type), format_mods(ev->keyboard_modifiers));
      7 +    if ((ev->keyboard_modifiers & (GLFW_MOD_SHIFT | GLFW_MOD_ALT | GLFW_MOD_CONTROL | GLFW_MOD_SUPER)) == (GLFW_MOD_CONTROL | GLFW_MOD_SHIFT)) {
      8 +        // ctrl+shift+wheel changes the font size instead of scrolling
      9 +        static double zoom_accumulator = 0.;
     10 +        switch (ev->offset_type) {
     11 +            case GLFW_SCROLL_OFFSET_LINES:
     12 +                zoom_accumulator += ev->y_offset;
     13 +                break;
     14 +            case GLFW_SCROLL_OFFEST_V120:
     15 +                zoom_accumulator += ev->y_offset / 120.;
     16 +                break;
     17 +            case GLFW_SCROLL_OFFEST_HIGHRES: {
     18 +                OSWindow *osw_ = global_state.callback_os_window;
     19 +                double cell_height = (osw_ && osw_->fonts_data) ? osw_->fonts_data->fcm.cell_height : 20.;
     20 +                zoom_accumulator += ev->y_offset / (3. * cell_height);
     21 +                break;
     22 +            }
     23 +        }
     24 +        int steps = (int)zoom_accumulator;
     25 +        if (steps) {
     26 +            zoom_accumulator -= steps;
     27 +            call_boss(change_font_size, "Osd", Py_True, steps > 0 ? "+" : "-", (double)abs(steps)/2);
     28 +        }
     29 +        return;
     30 +    }
     31      static id_type window_for_momentum_scroll = 0;
     32      static bool main_screen_for_momentum_scroll = false;
     33      // allow scroll events even if window is not currently focused (in