Ticket #3571: 3571-fixup-WEdit-use-the-new-mouse-API.patch

File 3571-fixup-WEdit-use-the-new-mouse-API.patch, 2.7 KB (added by mooffie, 9 years ago)
  • src/editor/editwidget.c

    From 6c5b26af80f515126793eb31543a6f3d6a610eef Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Thu, 18 Feb 2016 18:45:20 +0200
    Subject: [PATCH] fixup! WEdit: use the new mouse API.
    
    ---
     src/editor/editwidget.c | 26 +++++++++++++-------------
     1 file changed, 13 insertions(+), 13 deletions(-)
    
    diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c
    index 1ce8ed5..37471d6 100644
    a b edit_total_update (WEdit * edit) 
    758758/* --------------------------------------------------------------------------------------------- */ 
    759759 
    760760static gboolean 
    761 edit_update_cursor (WEdit * edit, mouse_event_t * event) 
     761edit_update_cursor (WEdit * edit, const mouse_event_t * event) 
    762762{ 
     763    int x, y; 
    763764    gboolean done; 
    764765 
     766    x = event->x - (edit->fullscreen ? 0 : 1); 
     767    y = event->y - (edit->fullscreen ? 0 : 1); 
     768 
    765769    if (edit->mark2 != -1 && event->msg == MSG_MOUSE_UP) 
    766770        return TRUE;            /* don't do anything */ 
    767771 
    768772    if (event->msg == MSG_MOUSE_DOWN || event->msg == MSG_MOUSE_UP) 
    769773        edit_push_key_press (edit); 
    770774 
    771     if (!edit->fullscreen) 
    772         event->x--; 
    773775    if (!option_cursor_beyond_eol) 
    774         edit->prev_col = event->x - edit->start_col - option_line_state_width; 
     776        edit->prev_col = x - edit->start_col - option_line_state_width; 
    775777    else 
    776778    { 
    777779        long line_len; 
    edit_update_cursor (WEdit * edit, mouse_event_t * event) 
    780782            edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer), 0, 
    781783                                edit_buffer_get_current_eol (&edit->buffer)); 
    782784 
    783         if (event->x + 1 > line_len) 
     785        if (x + 1 > line_len) 
    784786        { 
    785             edit->over_col = event->x - line_len - edit->start_col - option_line_state_width; 
     787            edit->over_col = x - line_len - edit->start_col - option_line_state_width; 
    786788            edit->prev_col = line_len; 
    787789        } 
    788790        else 
    789791        { 
    790792            edit->over_col = 0; 
    791             edit->prev_col = event->x - option_line_state_width - edit->start_col; 
     793            edit->prev_col = x - option_line_state_width - edit->start_col; 
    792794        } 
    793795    } 
    794796 
    795     if (!edit->fullscreen) 
    796         event->y--; 
    797     if (event->y > edit->curs_row) 
    798         edit_move_down (edit, event->y - edit->curs_row, 0); 
    799     else if (event->y < edit->curs_row) 
    800         edit_move_up (edit, edit->curs_row - event->y, 0); 
     797    if (y > edit->curs_row) 
     798        edit_move_down (edit, y - edit->curs_row, 0); 
     799    else if (y < edit->curs_row) 
     800        edit_move_up (edit, edit->curs_row - y, 0); 
    801801    else 
    802802        edit_move_to_prev_col (edit, edit_buffer_get_current_bol (&edit->buffer)); 
    803803