Ticket #3760: SOLUTION-NUMBER-3.patch

File SOLUTION-NUMBER-3.patch, 3.4 KB (added by mooffie, 7 years ago)
  • lib/widget/widget-common.c

    From 5f10e4467d7c35eecd672c846e10894ae3a29f4a Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Sun, 29 Jan 2017 22:26:55 +0200
    Subject: [PATCH] Ticket #3760: WEdit shouldn't handle mouse events of
     overlapping buttonbar.
    
    Signed-off-by: Mooffie <mooffie@gmail.com>
    ---
     lib/widget/widget-common.c | 16 +++++++++++++++-
     lib/widget/widget-common.h |  1 +
     src/editor/editwidget.c    |  9 ++++++++-
     3 files changed, 24 insertions(+), 2 deletions(-)
    
    diff --git a/lib/widget/widget-common.c b/lib/widget/widget-common.c
    index e6deefb..e6f9cdb 100644
    a b widget_focus (Widget * w) 
    9797 
    9898/** 
    9999 * Put widget on top or bottom of Z-order. 
     100 * 
     101 * (This function does not affect 'h->current'. That is, calling this 
     102 * function does not transfer the focus from any widget to another.) 
    100103 */ 
    101104static void 
    102105widget_reorder (GList * l, gboolean set_top) 
    widget_select (Widget * w) 
    499502 
    500503/* --------------------------------------------------------------------------------------------- */ 
    501504/** 
    502  * Set widget at bottom of widget list. 
     505 * Set widget at the bottom of the widget list. 
    503506 */ 
    504507 
    505508void 
    widget_set_bottom (Widget * w) 
    510513 
    511514/* --------------------------------------------------------------------------------------------- */ 
    512515/** 
     516 * Set widget at the top of the widget list. 
     517 */ 
     518 
     519void 
     520widget_set_top (Widget * w) 
     521{ 
     522    widget_reorder (dlg_find (w->owner, w), TRUE); 
     523} 
     524 
     525/* --------------------------------------------------------------------------------------------- */ 
     526/** 
    513527  * Check whether two widgets are overlapped or not. 
    514528  * @param a 1st widget 
    515529  * @param b 2nd widget 
  • lib/widget/widget-common.h

    diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h
    index 936d3fa..140983d 100644
    a b gboolean widget_overlapped (const Widget * a, const Widget * b); 
    190190void widget_replace (Widget * old, Widget * new); 
    191191void widget_select (Widget * w); 
    192192void widget_set_bottom (Widget * w); 
     193void widget_set_top (Widget * w); 
    193194 
    194195/* get mouse pointer location within widget */ 
    195196Gpm_Event mouse_get_local (const Gpm_Event * global, const Widget * w); 
  • src/editor/editwidget.c

    diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c
    index 515a586..a038e8d 100644
    a b edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v 
    871871static void 
    872872edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) 
    873873{ 
     874    WDialog *h = DIALOG (w); 
    874875    gboolean unhandled = TRUE; 
    875876 
    876877    if (msg == MSG_MOUSE_DOWN && event->y == 0) 
    877878    { 
    878         WDialog *h = DIALOG (w); 
    879879        WMenuBar *b; 
    880880 
    881881        b = find_menubar (h); 
    edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) 
    921921        } 
    922922    } 
    923923 
     924    /* The last line of the screen is where the buttonbar is. If the user 
     925     * clicks there, we bring the buttonbar to the top (Z-order) so that it 
     926     * gets sent the mouse event even if a windowed WEdit is on top of it 
     927     * (the WEdit still retains the focus). */ 
     928    if (msg == MSG_MOUSE_DOWN && event->y == LINES - 1) 
     929        widget_set_top (WIDGET (find_buttonbar (h))); 
     930 
    924931    /* Continue handling of unhandled event in window or menu */ 
    925932    event->result.abort = unhandled; 
    926933}