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) |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * 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.) |
100 | 103 | */ |
101 | 104 | static void |
102 | 105 | widget_reorder (GList * l, gboolean set_top) |
… |
… |
widget_select (Widget * w) |
499 | 502 | |
500 | 503 | /* --------------------------------------------------------------------------------------------- */ |
501 | 504 | /** |
502 | | * Set widget at bottom of widget list. |
| 505 | * Set widget at the bottom of the widget list. |
503 | 506 | */ |
504 | 507 | |
505 | 508 | void |
… |
… |
widget_set_bottom (Widget * w) |
510 | 513 | |
511 | 514 | /* --------------------------------------------------------------------------------------------- */ |
512 | 515 | /** |
| 516 | * Set widget at the top of the widget list. |
| 517 | */ |
| 518 | |
| 519 | void |
| 520 | widget_set_top (Widget * w) |
| 521 | { |
| 522 | widget_reorder (dlg_find (w->owner, w), TRUE); |
| 523 | } |
| 524 | |
| 525 | /* --------------------------------------------------------------------------------------------- */ |
| 526 | /** |
513 | 527 | * Check whether two widgets are overlapped or not. |
514 | 528 | * @param a 1st widget |
515 | 529 | * @param b 2nd widget |
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); |
190 | 190 | void widget_replace (Widget * old, Widget * new); |
191 | 191 | void widget_select (Widget * w); |
192 | 192 | void widget_set_bottom (Widget * w); |
| 193 | void widget_set_top (Widget * w); |
193 | 194 | |
194 | 195 | /* get mouse pointer location within widget */ |
195 | 196 | Gpm_Event mouse_get_local (const Gpm_Event * global, const Widget * w); |
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 |
871 | 871 | static void |
872 | 872 | edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) |
873 | 873 | { |
| 874 | WDialog *h = DIALOG (w); |
874 | 875 | gboolean unhandled = TRUE; |
875 | 876 | |
876 | 877 | if (msg == MSG_MOUSE_DOWN && event->y == 0) |
877 | 878 | { |
878 | | WDialog *h = DIALOG (w); |
879 | 879 | WMenuBar *b; |
880 | 880 | |
881 | 881 | b = find_menubar (h); |
… |
… |
edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) |
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
| 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 | |
924 | 931 | /* Continue handling of unhandled event in window or menu */ |
925 | 932 | event->result.abort = unhandled; |
926 | 933 | } |